JDK-8116403 : Labeled Controls like CheckBox minSize calculation is wrong
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-04-16
  • Updated: 2015-06-17
  • Resolved: 2013-04-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
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.
Comments
Target Build: b87
18-04-2013

Affected tests: ControlsAutomatedTestSuite/javafx/scene/control/test/labeled/CheckBoxesTest/buttonsTest ControlsAutomatedTestSuite/javafx/scene/control/test/labeled/CheckBoxesTest/constructorsTest ControlsAutomatedTestSuite/javafx/scene/control/test/labeled/CheckBoxesTest/setGraphicTextGapTest ControlsAutomatedTestSuite/javafx/scene/control/test/labeled/CheckBoxesTest/setTextTest
17-04-2013