A typical Labeled control, such as a text button, adds a hierarchy of five nodes to the scene graph. These are:
- Button (extends Labeled)
-- ButtonSkin (extends SkinBase)
--- Label (extends Labeled)
---- LabelSkin (extends BaseSkin)
----- Text
This can be reduced by two nodes by making the various skins for Labeled controls extend a LabeledSkinBase class, which directly manages the text and graphic nodes. The new hierarchy for the text button now becomes:
- Button (extends Labeled)
-- ButtonSkin (extends LabeledSkin)
--- Text
A new property "labelPadding" is needed on Labeled to manage the padding around the "label" part of composite Labeled controls, such as CheckBox, RadioButton, MenuButton, and SplitMenuButton. This property can be limited to be settable only from CSS with a key "-fx-label-padding", and can be made private in Labeled.