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

Improper prefHeight from TextField

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: fx2.0
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
      None

      Description

      After upgrading to JavaFX 2.0 final, our text fields have grown vertically, as shown in the attached screen shot.

      Because we support ultra high monitor resolutions, we are styling all text fields with a 60 px Myriad Pro Bold font and a padding of of 14 px 14 px 0 px 14 px.

      As can be seen from the screen shot, the selection bar reaches far below the font's descent - notice how low the 'j' reaches, and then notice how much further low the selection bar reaches. If you choose the same font in other (non-javafx) applications, the selection bar is not oversized this way, so it is not a problem with this particular font.
      Even if we set the bottom padding to 0 px, we still get this oversized look.

      I checked, and during layout, the text field returns a prefHeight of 104, which I believe is also what is rendered. This indicates, that it is not a rendering problem, but a prefHeight calculation problem. I tried forcing the field smaller by hacking a parent component which invokes

      textField.resize(prefWidth, 96);

      but even though this gives the text field size I want, this effectively pushes the text upwards which means I still get the oversized selection bar, but now part of the top dot of the 'j' looks cut off or hidden behind the padding.

      This was not a problem prior to JavaFX 2.0 final. In build 44 for instance, the selection bar reached below the text field, which made me file issue RT-17149. Could it be the case, that one of you tried to fix RT-17149, by forcing the text field to always be large enough to contain the selection bar? If that is the case, that solution is quite problematic as the screen shot here shows.

      A good place to start, is to investigate why a bottom padding of 0 px has no effect. Such a padding should mean that the lowest part of a 'p' og 'j' should barely touch the bottom border of the text field, however, with javafx it does not.


      See also: http://javafx-jira.kenai.com/browse/RT-17149

        Attachments

        1. font-comparison.png
          font-comparison.png
          10 kB
        2. myrtest.pdf
          33 kB
        3. oversized.png
          oversized.png
          13 kB
        4. RichardsTest.jpg
          RichardsTest.jpg
          27 kB

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: