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

Missing API that would report if baseline offset is based on text (for non-resizable Nodes)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u5
    • javafx
    • All

      getBaselineOffset() should return the baseline of text. Components that doesn't have text should return the magic number that tells that the baseline isn't used and the height should be used instead if a baseline is really wanted. (BASELINE_OFFSET_SAME_AS_HEIGHT).

      But. Nodes that aren't resizable instead returns the height as the baseline. That makes it impossible for a layout engine to know if the Node actually has a sane baseline or not.

      MigLayout by default aligns by the baseline (which all layout managers should do IMHO and it shouldn't have to be explicitly set on every widget, but that's another issue) and it now will align for instance Rectangle on that baseline as well which looks and is wrong.

      Either BASELINE_OFFSET_SAME_AS_HEIGHT should be returned for all nodes that doesn't have text or you should add a method to Node:

      boolean isBaselineSupported()

      If you feel that "well, everything has a baseline" then you can rename the method to

      boolean isTextBaselineSupported()

      But then you should also change the JavaDoc for getBaselineOffset() to not mention text as it does now. And you should probably also mention that you in that case don't use the standard interpretation of baseline, which is the baseline of text.

            Unassigned Unassigned
            mgrev Mikael Grev
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Imported: