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

Tooltip requires setPrefWidth() to wrap text

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • tbd
    • None
    • javafx

    Description

      Using Tooltip#setWrapText(true) will only have any effect if Tooltip#setPrefWidth() is also called - otherwise, it will just overrun any text large enough.

      While this is a somewhat desirable behavior in other Labeled controls, it will result in having a large empty space when the text is small so one can have a large text wrapped properly (think of a ListCell with editable content, for instance: when the text is small, you want the tooltip to show it and have no extra space. When it's large, you want it to wrap so the user can read it entirely if it's being overrun in the cell).

      The suggested behavior is either
      - Wrapping using maxWidth; or
      - Having a method like Text#setWrappingWidth()

      Attachments

        Activity

          People

            Unassigned Unassigned
            duke J. Duke
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Imported: