Package javafx.scene.control
Class Label
java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.control.Control
javafx.scene.control.Labeled
javafx.scene.control.Label
- All Implemented Interfaces:
LayoutMeasurable
,LayoutMeasurableMixin
,HasAlignmentProperty
,HasBackgroundProperty
,HasBlendModeProperty
,HasBorderProperty
,HasClipProperty
,HasEffectProperty
,HasFontProperty
,HasGraphicProperty
,HasHeightProperty
,HasImageUrlProperty
,HasLayoutXProperty
,HasLayoutYProperty
,HasManagedProperty
,HasMaxHeightProperty
,HasMaxWidthProperty
,HasMinHeightProperty
,HasMinWidthProperty
,HasMouseTransparentProperty
,HasOnMouseClickedProperty
,HasOpacityProperty
,HasPaddingProperty
,HasParentProperty
,HasPrefHeightProperty
,HasPrefWidthProperty
,HasSnapToPixelProperty
,HasTextAlignmentProperty
,HasTextFillProperty
,HasTextProperty
,HasVisibleProperty
,HasWidthProperty
,Styleable
,EventTarget
,Skinnable
,INode
,PreferenceResizableNode
Label is a non-editable text control. A Label is useful for displaying
text that is required to fit within a specific space, and thus may need
to use an ellipsis or truncation to size the string to fit. Labels also are
useful in that they can have mnemonics which, if used, will send focus to
the Control listed as the target of the
labelFor
property.
Label sets focusTraversable to false.
Example:
Label label = new Label("a label");
- Since:
- JavaFX 2.0
-
Property Summary
TypePropertyDescriptionA Label can act as a label for a different Control or Node.Properties inherited from class javafx.scene.control.Labeled
alignment, contentDisplay, ellipsisString, font, graphic, graphicTextGap, imageUrl, labelPadding, lineSpacing, textAlignment, textFill, textOverrun, text, wrapText
Properties inherited from class javafx.scene.control.Control
contextMenu, skin
Properties inherited from class javafx.scene.layout.Region
background, border, height, insets, maxHeight, maxWidth, minHeight, minWidth, padding, prefHeight, prefWidth, snapToPixel, width
Properties inherited from class javafx.scene.Parent
needsLayout
Properties inherited from class javafx.scene.Node
blendMode, cacheHint, cache, clip, cursor, disabled, disable, effect, eventDispatcher, focused, focusTraversable, hover, id, layoutBounds, layoutX, layoutY, managed, mouseTransparent, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragged, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onScroll, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, opacity, parent, pressed, rotate, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, visible
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBlendModeProperty
blendMode
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasClipProperty
clip
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasEffectProperty
effect
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutXProperty
layoutX
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutYProperty
layoutY
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasManagedProperty
managed
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMouseTransparentProperty
mouseTransparent
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOnMouseClickedProperty
onMouseClicked
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOpacityProperty
opacity
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasParentProperty
parent
Properties inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasVisibleProperty
visible
-
Field Summary
Fields inherited from interface javafx.scene.INode
BASELINE_OFFSET_SAME_AS_HEIGHT
Fields inherited from interface javafx.scene.layout.PreferenceResizableNode
USE_COMPUTED_SIZE, USE_PREF_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Skin<?>
Create a new instance of the default skin for this control.final Node
Gets the value of thelabelFor
property.A Label can act as a label for a different Control or Node.final void
setLabelFor
(Node value) Sets the value of thelabelFor
property.Methods inherited from class javafx.scene.control.Labeled
alignmentProperty, contentDisplayProperty, ellipsisStringProperty, fontProperty, getContentBias, getContentDisplay, getEllipsisString, getGraphicTextGap, getLabelPadding, getLineSpacing, getTextOverrun, graphicProperty, graphicTextGapProperty, imageUrlProperty, isWrapText, labelPaddingProperty, lineSpacingProperty, setContentDisplay, setEllipsisString, setGraphicTextGap, setLineSpacing, setScene, setTextOverrun, setWrapText, textAlignmentProperty, textFillProperty, textOverrunProperty, textProperty, wrapTextProperty
Methods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getSkin, layoutChildren, setContextMenu, setSkin, shouldUseLayoutMeasurable, skinProperty
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, boundedSize, getInsets, heightProperty, impl_computeGeomBounds, impl_computeLayoutBounds, impl_maxHeight, impl_maxWidth, impl_minHeight, impl_minWidth, impl_prefHeight, impl_prefWidth, insetsProperty, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeightProperty, maxWidthProperty, minHeightProperty, minWidthProperty, paddingProperty, positionInArea, positionInArea, prefHeightProperty, prefWidthProperty, resize, setMaxSize, setMinSize, setPrefSize, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
Methods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, isNeedsLayout, layout, needsLayoutProperty, requestLayout, requestParentLayout, setLayoutFlag, setNeedsLayout, setSceneRoot
Methods inherited from class javafx.scene.Node
addEventFilter, addEventHandler, autosize, blendModeProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, createLayoutMeasurable, cursorProperty, disabledProperty, disableProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAllNodeTransforms, getBoundsInLocal, getCacheHint, getCursor, getEventDispatcher, getId, getLayoutMeasurable, getNodePeer, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseDragged, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnScroll, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOrCreateAndBindNodePeer, getProperties, getRotate, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleClass, getTransforms, getTranslateX, getTranslateY, getUserData, hasProperties, hoverProperty, idProperty, impl_getLayoutBounds, impl_isTreeVisible, impl_traverse, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isPressed, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToScene, localToScene, localToScreen, localToScreen, localToScreen, localToScreen, managedProperty, mouseTransparentProperty, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDraggedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onNodePeerReady, onPeerSizeChanged, onScrollProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, opacityProperty, parentProperty, parentToLocal, pressedProperty, removeEventFilter, removeEventHandler, requestFocus, requestPeerFocus, rotateProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, setCache, setCacheHint, setCursor, setDisable, setDisabled, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setNodePeer, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseDragged, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnScroll, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setPressed, setRotate, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setUserData, snapshot, startDragAndDrop, styleProperty, toBack, toFront, translateXProperty, translateYProperty, visibleProperty
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasAlignmentProperty
getAlignment, setAlignment
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBackgroundProperty
getBackground, setBackground
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBlendModeProperty
blendModeProperty, getBlendMode, setBlendMode
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasBorderProperty
getBorder, setBorder
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasClipProperty
clipProperty, getClip, setClip
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasEffectProperty
effectProperty, getEffect, setEffect
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasFontProperty
getFont, setFont
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasGraphicProperty
getGraphic, setGraphic
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasHeightProperty
getHeight, setHeight
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasImageUrlProperty
getImageUrl, setImageUrl
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutXProperty
getLayoutX, layoutXProperty, setLayoutX
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasLayoutYProperty
getLayoutY, layoutYProperty, setLayoutY
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasManagedProperty
isManaged, managedProperty, setManaged
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMaxHeightProperty
getMaxHeight, setMaxHeight
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMaxWidthProperty
getMaxWidth, setMaxWidth
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMinHeightProperty
getMinHeight, setMinHeight
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMinWidthProperty
getMinWidth, setMinWidth
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasMouseTransparentProperty
isMouseTransparent, mouseTransparentProperty, setMouseTransparent
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOnMouseClickedProperty
getOnMouseClicked, onMouseClickedProperty, setOnMouseClicked
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasOpacityProperty
getOpacity, opacityProperty, setOpacity
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPaddingProperty
getPadding, setPadding
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasParentProperty
getParent, parentProperty, setParent
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPrefHeightProperty
getPrefHeight, setPrefHeight
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasPrefWidthProperty
getPrefWidth, setPrefWidth
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasSnapToPixelProperty
isSnapToPixel, setSnapToPixel
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasTextAlignmentProperty
getTextAlignment, setTextAlignment
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasTextFillProperty
getTextFill, setTextFill
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasTextProperty
getText, setText
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasVisibleProperty
isVisible, setVisible, visibleProperty
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasWidthProperty
getWidth, setWidth
Methods inherited from interface javafx.scene.INode
autosize, getAllNodeTransforms, getNodePeer, getOrCreateAndBindNodePeer, getProperties, getScene, getTransforms, hasProperties, relocate, resizeRelocate
Methods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.emul_coupling.LayoutMeasurableMixin
clearCache, getLayoutBounds, getLayoutMeasurable, maxHeight, maxWidth, minHeight, minWidth, prefHeight, prefWidth
Methods inherited from interface javafx.scene.layout.PreferenceResizableNode
isResizable
-
Property Details
-
labelFor
A Label can act as a label for a different Control or Node. This is used for Mnemonics and Accelerator parsing. This allows setting of the target Node.- See Also:
-
-
Constructor Details
-
Label
public Label()Creates an empty label -
Label
Creates Label with supplied text.- Parameters:
text
- null text is treated as the empty string
-
Label
Creates a Label with the supplied text and graphic.- Parameters:
text
- null text is treated as the empty stringgraphic
- a null graphic is acceptable
-
-
Method Details
-
labelForProperty
A Label can act as a label for a different Control or Node. This is used for Mnemonics and Accelerator parsing. This allows setting of the target Node.- Returns:
- the
labelFor
property - See Also:
-
setLabelFor
Sets the value of thelabelFor
property.- Property description:
- A Label can act as a label for a different Control or Node. This is used for Mnemonics and Accelerator parsing. This allows setting of the target Node.
- Parameters:
value
- the value for thelabelFor
property- See Also:
-
getLabelFor
Gets the value of thelabelFor
property.- Property description:
- A Label can act as a label for a different Control or Node. This is used for Mnemonics and Accelerator parsing. This allows setting of the target Node.
- Returns:
- the value of the
labelFor
property - See Also:
-
createDefaultSkin
Description copied from class:Control
Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS-fx-skin
or set explicitly in a sub-class withsetSkin(...)
.- Overrides:
createDefaultSkin
in classControl
- Returns:
- new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
-