Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8101503

Allow formatted text on a label

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
      None

      Description

      It is sometimes necessary to style individual words or characters of a label. Examples include

      1. Underlining a letter of a word which communicates a keyboard shortcut
      2. Emphasizing something as being an entity as in this message: "The customer *Stella Johnsson* is not a member of the group *International*.

      In swing you could make JLabel do this by setting its contents to "This is <b>in bold letters</b>". As I recall, both <b>, <i> and <u> was supported.

      I do not think Swing's solution to this was particularly flexible nor elegant. I would prefer the <span> tag to be supported, allowing me to decouple the styling into a .css file:

      myLabel.setText("This is an <span class="employeeId">employee id</span>.");

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              leifs Leif Samuelsson (Inactive)
              Reporter:
              risaksen Randahl Isaksen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: