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 |
|---|---|
ObjectProperty<ContextMenu> |
contextMenu
The ContextMenu to show for this control.
|
ObjectProperty<Skin<?>> |
skin
Skin is responsible for rendering this
Control. |
ObjectProperty<Tooltip> |
tooltip
The ToolTip for this control.
|
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthneedsLayoutaccessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, visibleUSE_COMPUTED_SIZE, USE_PREF_SIZEBASELINE_OFFSET_SAME_AS_HEIGHT| 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)
Computes the preferred height of this region for the given width;
Region subclasses should override this method to return an appropriate
value based on their content and layout strategy.
|
protected double |
computePrefWidth(double height)
Computes the preferred width of this region for the given height.
|
ObjectProperty<ContextMenu> |
contextMenuProperty()
The ContextMenu to show for this control.
|
protected Skin<?> |
createDefaultSkin()
Create a new instance of the default skin for this control.
|
void |
executeAccessibleAction(AccessibleAction action,
Object... parameters)
This method is called by the assistive technology to request the action
indicated by the argument should be executed.
|
double |
getBaselineOffset()
Calculates the baseline offset based on the first managed child.
|
static List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
ContextMenu |
getContextMenu()
Gets the value of the property contextMenu.
|
protected List<CssMetaData<? extends Styleable,?>> |
getControlCssMetaData() |
List<CssMetaData<? extends Styleable,?>> |
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. |
Skin<?> |
getSkin()
Gets the value of the property skin.
|
Tooltip |
getTooltip()
Gets the value of the property tooltip.
|
boolean |
isResizable()
Returns
true since all Controls are resizable. |
protected void |
layoutChildren()
Invoked during the layout pass to layout the children in this
Parent. |
Object |
queryAccessibleAttribute(AccessibleAttribute attribute,
Object... parameters)
*
Accessibility handling *
*
|
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.
|
ObjectProperty<Skin<?>> |
skinProperty()
Skin is responsible for rendering this
Control. |
ObjectProperty<Tooltip> |
tooltipProperty()
The ToolTip for this control.
|
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapSize, snapSpace, snapToPixelProperty, widthPropertygetChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsaccessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visiblePropertypublic final ObjectProperty<Skin<?>> 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 SkinnablegetSkin(),
setSkin(Skin)public final ObjectProperty<Tooltip> tooltipProperty
getTooltip(),
setTooltip(Tooltip)public final ObjectProperty<ContextMenu> contextMenuProperty
getContextMenu(),
setContextMenu(ContextMenu)public final ObjectProperty<Skin<?>> 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 SkinnablegetSkin(),
setSkin(Skin)public final void setSkin(Skin<?> value)
setSkin in interface SkinnableControl. 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.
public final Skin<?> getSkin()
getSkin in interface SkinnableControl. 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.
public final ObjectProperty<Tooltip> tooltipProperty()
getTooltip(),
setTooltip(Tooltip)public final void setTooltip(Tooltip value)
public final Tooltip getTooltip()
public final ObjectProperty<ContextMenu> contextMenuProperty()
getContextMenu(),
setContextMenu(ContextMenu)public final void setContextMenu(ContextMenu value)
public final ContextMenu getContextMenu()
public boolean isResizable()
true since all Controls are resizable.isResizable in class RegionNode.getContentBias(),
Node.minWidth(double),
Node.minHeight(double),
Node.prefWidth(double),
Node.prefHeight(double),
Node.maxWidth(double),
Node.maxHeight(double),
Node.resize(double, double),
Node.getLayoutBounds()protected double computeMinWidth(double height)
Node.minWidth(double) method
of the Skin. If the Skin is null, the returned value is 0.computeMinWidth in class Regionheight - 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.computeMinHeight in class Regionwidth - 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.computeMaxWidth in class Regionheight - 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.computeMaxHeight in class Regionwidth - The width of the Control, in case this value might dictate
the maximum height.protected double computePrefWidth(double height)
computePrefWidth in class Regionheight - the height that should be used if preferred width depends
on itprotected double computePrefHeight(double width)
computePrefHeight in class Regionwidth - the width that should be used if preferred height depends
on itpublic double getBaselineOffset()
Node.getBaselineOffset().getBaselineOffset in class Parentprotected void layoutChildren()
Parent. By default it will only set the size of managed,
resizable content to their preferred sizes and does not do any node
positioning.
Subclasses should override this function to layout content as needed.
layoutChildren in class Parentprotected Skin<?> createDefaultSkin()
-fx-skin or set explicitly in a sub-class with setSkin(...).public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public final List<CssMetaData<? extends Styleable,?>> 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.
getCssMetaData in interface StyleablegetCssMetaData in class Regionprotected List<CssMetaData<? extends Styleable,?>> getControlCssMetaData()
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
queryAccessibleAttribute in class Parentattribute - the requested attributeparameters - optional list of parametersAccessibleAttributepublic void executeAccessibleAction(AccessibleAction action, Object... parameters)
Node
This method is commonly overridden by subclasses to implement
action that are required for a specific role.
If a particular action is not handled, the super class implementation
must be called.
executeAccessibleAction in class Nodeaction - the action to executeparameters - optional list of parametersAccessibleActionCopyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.