Skip to content

One text widget to rule them all #166

@Luro02

Description

@Luro02

What the text widget should be able to do?

  • Display text
  • Wrap text if parent is too small: word wrapping and if that is not possible character based wrapping
  • Stylized text like bold, italic, colored, underlined
  • Have clickable links in the text
  • Align the text horizontally
  • Allow for vertical alignment, if the text uses more height than necessary like is the case with JTextPane
  • Changing the font/text size
  • Selectable text to copy it

These are basic requirements that modern UI frameworks satisfy through a text widget. For swing, this is not the case at all, there are many different widgets, none satisfying everything

  • JLabel (or JBLabel): Does not support wrapping
  • JTextPane: Occupies more height than necessary -> Needs vertical centering/other hacks that I have yet to figure out
  • DslLabel: IntelliJ subclass of JTextPane, doesn't really work with wrapping
  • JTextArea

The best candidate for an universal widget at the moment is a decently modified JTextPane with an underlying HtmlEditorTextKit, but it suffers from some issues like using too much vertical space (-> text must be aligned or the bug must be fixed) or styles not always applying.

For reference, this might work.


This issue is in parts related to #162.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions