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

Labeled Controls like CheckBox minSize calculation is wrong

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
      None

      Description

      All controls that extend LabeledSkinBase and override computePrefWidth() or computePrefHeight() also have to override computeMinWidth() and computeMinHeight(). Otherwise you end up with issues where the minSize is too small and a control draws outside its bounds when at minimum size.

      For example CheckBox when the box part is higher than the text the pref height is box size + insets. The min size doesn't know about the box because its in LabeledSkinBase and not overridden so it comes out smaller. So for me the minHeight of check box is 1px smaller than the prefHeight() and it should be the same. This manifested its self in the bug RT-29645 where a checkbox was given a border and its maxSize was set to 10 which caused the checkbox to be sized at its minimum. The minimum is smaller than box+insets so border is drawn over top of box.

      This needs to be fixed in all controls like CheckBox and RadioButton that extend LabeledSkinBase and override computePrefWidth() or computePrefHeight(). The fix is to add overridden methods for computeMinWidth() and computeMinHeight() that do something similar to the computePrefWidth() and computePrefHeight() implementations.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jgiles Jonathan Giles
              Reporter:
              jasper Jasper Potts
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved:
                Imported: