public abstract class Control extends Region implements Skinnable
Additionally, controls support explicit skinning to make it easy to leverage the functionality of a control while customizing its appearance.
See specific Control subclasses for information on how to use individual types of controls.
Most controls have their focusTraversable property set to true by default, however
read-only controls such as Label
and ProgressIndicator
, and some
controls that are containers ScrollPane
and ToolBar
do not.
Consult individual control documentation for details.
Type | Property and Description |
---|---|
<any> |
contextMenu
The ContextMenu to show for this control.
|
(package private) StringProperty |
skinClassName |
<any> |
skin
Skin is responsible for rendering this
Control . |
<any> |
tooltip
The ToolTip for this control.
|
Modifier and Type | Class and Description |
---|---|
private static class |
Control.StyleableProperties
*
StyleSheet Handling *
*
|
Modifier and Type | Field and Description |
---|---|
private <any> |
contextMenu
The ContextMenu to show for this control.
|
private static <any> |
contextMenuHandler
Handles context menu requests by popping up the menu.
|
private java.lang.String |
currentSkinClassName
Keeps a reference to the name of the class currently acting as the skin.
|
private <any> |
skin |
private SkinBase<?> |
skinBase
A private reference directly to the SkinBase instance that is used as the
Skin for this Control.
|
private StringProperty |
skinClassName |
private boolean |
skinCreationLocked |
private java.util.List<<any>> |
styleableProperties
*
Private fields *
*
|
private <any> |
tooltip |
Modifier | Constructor and Description |
---|---|
protected |
Control()
Create a new Control.
|
Modifier and Type | Method and Description |
---|---|
protected double |
computeMaxHeight(double width)
Computes the maximum allowable height of the Control, based on the provided
width.
|
protected double |
computeMaxWidth(double height)
Computes the maximum allowable width of the Control, based on the provided
height.
|
protected double |
computeMinHeight(double width)
Computes the minimum allowable height of the Control, based on the provided
width.
|
protected double |
computeMinWidth(double height)
Computes the minimum allowable width of the Control, based on the provided
height.
|
protected double |
computePrefHeight(double width) |
protected double |
computePrefWidth(double height) |
<any> |
contextMenuProperty()
The ContextMenu to show for this control.
|
protected Skin<?> |
createDefaultSkin()
Create a new instance of the default skin for this control.
|
private void |
doProcessCSS() |
void |
executeAccessibleAction(AccessibleAction action,
java.lang.Object... parameters) |
double |
getBaselineOffset() |
static java.util.List<<any>> |
getClassCssMetaData() |
ContextMenu |
getContextMenu()
Gets the value of the property contextMenu.
|
(package private) <any> |
getControlChildren()
*
Package API for SkinBase *
*
|
protected java.util.List<<any>> |
getControlCssMetaData() |
java.util.List<<any>> |
getCssMetaData()
This method returns a
List containing all CssMetaData for
both this Control (returned from getControlCssMetaData() and its
Skin , assuming the skin property is a
SkinBase . |
protected java.lang.Boolean |
getInitialFocusTraversable()
Returns the initial focus traversable state of this control, for use
by the JavaFX CSS engine to correctly set its initial value.
|
Skin<?> |
getSkin()
Gets the value of the property skin.
|
private Node |
getSkinNode()
Gets the Skin's node, or returns null if there is no Skin.
|
Tooltip |
getTooltip()
Gets the value of the property tooltip.
|
boolean |
isResizable()
Returns
true since all Controls are resizable. |
protected void |
layoutChildren() |
private static java.lang.Class<?> |
loadClass(java.lang.String className,
java.lang.Object instance)
Utility for loading a class in a manner that will work with multiple
class loaders, as is typically found in OSGI modular applications.
|
(package private) static void |
loadSkinClass(Skinnable control,
java.lang.String skinClassName) |
java.lang.Object |
queryAccessibleAttribute(AccessibleAttribute attribute,
java.lang.Object... parameters) |
void |
setContextMenu(ContextMenu value)
Sets the value of the property contextMenu.
|
void |
setSkin(Skin<?> value)
Sets the value of the property skin.
|
void |
setTooltip(Tooltip value)
Sets the value of the property tooltip.
|
(package private) StringProperty |
skinClassNameProperty() |
<any> |
skinProperty()
Skin is responsible for rendering this
Control . |
<any> |
tooltipProperty()
The ToolTip for this control.
|
public final <any> skinProperty
Control
. From the
perspective of the Control
, the Skin
is a black box.
It listens and responds to changes in state in a Control
.
There is a one-to-one relationship between a Control
and its
Skin
. Every Skin
maintains a back reference to the
Control
via the Skin.getSkinnable()
method.
A skin may be null.
skinProperty
in interface Skinnable
getSkin()
,
setSkin(Skin)
public final <any> tooltipProperty
getTooltip()
,
setTooltip(Tooltip)
public final <any> contextMenuProperty
getContextMenu()
,
setContextMenu(ContextMenu)
StringProperty skinClassNameProperty
private java.util.List<<any>> styleableProperties
private SkinBase<?> skinBase
private static final <any> contextMenuHandler
private <any> skin
private <any> tooltip
private <any> contextMenu
private java.lang.String currentSkinClassName
private StringProperty skinClassName
private boolean skinCreationLocked
private static java.lang.Class<?> loadClass(java.lang.String className, java.lang.Object instance) throws java.lang.ClassNotFoundException
className
- The name of the class we want to loadinstance
- An optional instance used to help find the class to loadjava.lang.ClassNotFoundException
- If the class cannot be found using any technique.public final <any> skinProperty()
Control
. From the
perspective of the Control
, the Skin
is a black box.
It listens and responds to changes in state in a Control
.
There is a one-to-one relationship between a Control
and its
Skin
. Every Skin
maintains a back reference to the
Control
via the Skin.getSkinnable()
method.
A skin may be null.
skinProperty
in interface Skinnable
getSkin()
,
setSkin(Skin)
public final void setSkin(Skin<?> value)
public final Skin<?> getSkin()
public final <any> tooltipProperty()
getTooltip()
,
setTooltip(Tooltip)
public final void setTooltip(Tooltip value)
public final Tooltip getTooltip()
public final <any> contextMenuProperty()
getContextMenu()
,
setContextMenu(ContextMenu)
public final void setContextMenu(ContextMenu value)
public final ContextMenu getContextMenu()
public boolean isResizable()
true
since all Controls are resizable.protected double computeMinWidth(double height)
Node#minWidth(double)
method
of the Skin
. If the Skin is null, the returned value is 0.height
- The height of the Control, in case this value might dictate
the minimum width.protected double computeMinHeight(double width)
Node#minHeight(double)
method
of the Skin
. If the Skin is null, the returned value is 0.width
- The width of the Control, in case this value might dictate
the minimum height.protected double computeMaxWidth(double height)
Node#maxWidth(double)
method
of the Skin
. If the Skin is null, the returned value is 0.height
- The height of the Control, in case this value might dictate
the maximum width.protected double computeMaxHeight(double width)
Node#maxHeight(double)
method
of the Skin
. If the Skin is null, the returned value is 0.width
- The width of the Control, in case this value might dictate
the maximum height.protected double computePrefWidth(double height)
protected double computePrefHeight(double width)
public double getBaselineOffset()
protected void layoutChildren()
protected Skin<?> createDefaultSkin()
-fx-skin
or set explicitly in a sub-class with setSkin(...)
.<any> getControlChildren()
private Node getSkinNode()
StringProperty skinClassNameProperty()
static void loadSkinClass(Skinnable control, java.lang.String skinClassName)
public static java.util.List<<any>> getClassCssMetaData()
public final java.util.List<<any>> getCssMetaData()
List
containing all CssMetaData
for
both this Control (returned from getControlCssMetaData()
and its
Skin
, assuming the skin property
is a
SkinBase
.
Developers who wish to provide custom CssMetaData are therefore
encouraged to override getControlCssMetaData()
or
SkinBase.getCssMetaData()
, depending on where the CssMetaData
resides.
protected java.util.List<<any>> getControlCssMetaData()
private void doProcessCSS()
protected java.lang.Boolean getInitialFocusTraversable()
public java.lang.Object queryAccessibleAttribute(AccessibleAttribute attribute, java.lang.Object... parameters)
public void executeAccessibleAction(AccessibleAction action, java.lang.Object... parameters)