Class Labeled
- All Implemented Interfaces:
-
Styleable,EventTarget,Skinnable
- Direct Known Subclasses:
-
ButtonBase,Cell,Label,TitledPane
@DefaultProperty("text") public abstract class Labeled extends Control Control is one which has as part of its user interface a textual content associated with it. For example, a Button displays text, as does a Label, a Tooltip, and many other controls. Labeled is also a convenient base class from which to extend when building new Controls which, as part of their UI, display read-only textual content.
Example of how to place a graphic above the text:
Image image = new Image(getClass().getResourceAsStream("image.png"));
ImageView imageView = new ImageView();
imageView.setImage(image);
Label label = new Label("text", imageView);
label.setContentDisplay(ContentDisplay.TOP);
- Since:
- JavaFX 2.0
- See Also:
Property Summary
| Type | Property | Description |
|---|---|---|
final ObjectProperty |
alignment |
Specifies how the text and graphic within the Labeled should be aligned when there is empty space within the Labeled. |
final ObjectProperty |
contentDisplay |
Specifies the positioning of the graphic relative to the text. |
final StringProperty |
ellipsisString |
Specifies the string to display for the ellipsis when text is truncated. |
final ObjectProperty |
font |
The default font to use for text in the Labeled. |
final ObjectProperty |
graphic |
An optional icon for the Labeled. |
final DoubleProperty |
graphicTextGap |
The amount of space between the graphic and text |
final ReadOnlyObjectProperty |
labelPadding |
The padding around the Labeled's text and graphic content. |
final DoubleProperty |
lineSpacing |
Specifies the space in pixel between lines. |
final BooleanProperty |
mnemonicParsing |
MnemonicParsing property to enable/disable text parsing. |
final ObjectProperty |
textAlignment |
Specifies the behavior for lines of text when text is multiline. |
final ObjectProperty |
textFill |
The Paint used to fill the text. |
final ObjectProperty |
textOverrun |
Specifies the behavior to use if the text of the Labeled exceeds the available space for rendering the text. |
final StringProperty |
text |
The text to display in the label. |
final ReadOnlyBooleanProperty |
textTruncated |
Indicates whether the text has been truncated because it cannot fit into the available width. |
final BooleanProperty |
underline |
Whether all text should be underlined. |
final BooleanProperty |
wrapText |
If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line. |
Properties declared in class javafx.scene.control.Control
contextMenu, skin, tooltip
Properties declared in class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
Properties declared in class javafx.scene.Parent
needsLayout
Properties declared in class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, 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, viewOrder, visible
Field Summary
Fields declared in class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZE
Fields declared in class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
Constructor Summary
| Constructor | Description |
|---|---|
Labeled() |
Creates a Label with no text and graphic |
Labeled |
Creates a Label with text |
Labeled |
Creates a Label with text and a graphic |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
final ObjectProperty |
alignmentProperty() |
Specifies how the text and graphic within the Labeled should be aligned when there is empty space within the Labeled. |
final ObjectProperty |
contentDisplayProperty() |
Specifies the positioning of the graphic relative to the text. |
final StringProperty |
ellipsisStringProperty() |
Specifies the string to display for the ellipsis when text is truncated. |
final ObjectProperty |
fontProperty() |
The default font to use for text in the Labeled. |
final Pos |
getAlignment() |
Gets the value of the alignment property. |
static List |
getClassCssMetaData() |
Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses. |
Orientation |
getContentBias() |
If wrapText is true, then contentBias will be HORIZONTAL, otherwise it is null. |
final ContentDisplay |
getContentDisplay() |
Gets the value of the contentDisplay property. |
List |
getControlCssMetaData() |
Gets the unmodifiable list of the control's CSS-styleable properties. |
final String |
getEllipsisString() |
Gets the value of the ellipsisString property. |
final Font |
getFont() |
Gets the value of the font property. |
final Node |
getGraphic() |
Gets the value of the graphic property. |
final double |
getGraphicTextGap() |
Gets the value of the graphicTextGap property. |
protected Pos |
getInitialAlignment() |
Returns the initial alignment state of this control, for use by the JavaFX CSS engine to correctly set its initial value. |
final Insets |
getLabelPadding() |
Gets the value of the labelPadding property. |
final double |
getLineSpacing() |
Gets the value of the lineSpacing property. |
final String |
getText() |
Gets the value of the text property. |
final TextAlignment |
getTextAlignment() |
Gets the value of the textAlignment property. |
final Paint |
getTextFill() |
Gets the value of the textFill property. |
final OverrunStyle |
getTextOverrun() |
Gets the value of the textOverrun property. |
final ObjectProperty |
graphicProperty() |
An optional icon for the Labeled. |
final DoubleProperty |
graphicTextGapProperty() |
The amount of space between the graphic and text |
final boolean |
isMnemonicParsing() |
Gets the value of the mnemonicParsing property. |
final boolean |
isTextTruncated() |
Gets the value of the textTruncated property. |
final boolean |
isUnderline() |
Gets the value of the underline property. |
final boolean |
isWrapText() |
Gets the value of the wrapText property. |
final ReadOnlyObjectProperty |
labelPaddingProperty() |
The padding around the Labeled's text and graphic content. |
final DoubleProperty |
lineSpacingProperty() |
Specifies the space in pixel between lines. |
final BooleanProperty |
mnemonicParsingProperty() |
MnemonicParsing property to enable/disable text parsing. |
final void |
setAlignment |
Sets the value of the alignment property. |
final void |
setContentDisplay |
Sets the value of the contentDisplay property. |
final void |
setEllipsisString |
Sets the value of the ellipsisString property. |
final void |
setFont |
Sets the value of the font property. |
final void |
setGraphic |
Sets the value of the graphic property. |
final void |
setGraphicTextGap |
Sets the value of the graphicTextGap property. |
final void |
setLineSpacing |
Sets the value of the lineSpacing property. |
final void |
setMnemonicParsing |
Sets the value of the mnemonicParsing property. |
final void |
setText |
Sets the value of the text property. |
final void |
setTextAlignment |
Sets the value of the textAlignment property. |
final void |
setTextFill |
Sets the value of the textFill property. |
final void |
setTextOverrun |
Sets the value of the textOverrun property. |
final void |
setUnderline |
Sets the value of the underline property. |
final void |
setWrapText |
Sets the value of the wrapText property. |
final ObjectProperty |
textAlignmentProperty() |
Specifies the behavior for lines of text when text is multiline. |
final ObjectProperty |
textFillProperty() |
The Paint used to fill the text. |
final ObjectProperty |
textOverrunProperty() |
Specifies the behavior to use if the text of the Labeled exceeds the available space for rendering the text. |
final StringProperty |
textProperty() |
The text to display in the label. |
final ReadOnlyBooleanProperty |
textTruncatedProperty() |
Indicates whether the text has been truncated because it cannot fit into the available width. |
final BooleanProperty |
underlineProperty() |
Whether all text should be underlined. |
final BooleanProperty |
wrapTextProperty() |
If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line. |
Methods declared in class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, contextMenuProperty, createDefaultSkin, getContextMenu, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
Methods declared in class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computePrefHeight, computePrefWidth, 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, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
Methods declared in class javafx.scene.Parent
getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
Methods declared in class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, 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, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, 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, lookup, 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, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, requestFocusTraversal, 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, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods declared in interface javafx.css.Styleable
getStyleableNode
Property Details
text
public final StringProperty textProperty
- Default value:
- empty string
- See Also:
alignment
public final ObjectProperty<Pos> alignmentProperty
- Default value:
Pos.CENTER_LEFT- See Also:
textAlignment
public final ObjectProperty<TextAlignment> textAlignmentProperty
contentDisplayProperty() which affects the graphic and text, this setting only affects multiple lines of text relative to the text bounds.- Default value:
TextAlignment.LEFT- See Also:
textOverrun
public final ObjectProperty<OverrunStyle> textOverrunProperty
Labeled exceeds the available space for rendering the text.- Default value:
OverrunStyle.ELLIPSIS- See Also:
ellipsisString
public final StringProperty ellipsisStringProperty
| Examples | |
|---|---|
| "..." | Default value for most locales |
| " . . . " | |
| " [...] " | |
| "\u2026" | The Unicode ellipsis character '…' |
| "" | No ellipsis, just display the truncated string |
Note that not all fonts support all Unicode characters.
- Default value:
"..."- Since:
- JavaFX 2.2
- See Also:
wrapText
public final BooleanProperty wrapTextProperty
- Default value:
false- See Also:
font
public final ObjectProperty<Font> fontProperty
- Default value:
Font.getDefault()- See Also:
graphic
public final ObjectProperty<Node> graphicProperty
setContentDisplay(javafx.scene.control.ContentDisplay). The node specified for this variable cannot appear elsewhere in the scene graph, otherwise the IllegalArgumentException is thrown. See the class description of Node for more detail.- Default value:
null- See Also:
underline
public final BooleanProperty underlineProperty
- Default value:
false- See Also:
lineSpacing
public final DoubleProperty lineSpacingProperty
- Default value:
- 0
- Since:
- JavaFX 8.0
- See Also:
contentDisplay
public final ObjectProperty<ContentDisplay> contentDisplayProperty
- Default value:
ContentDisplay.LEFT- See Also:
labelPadding
public final ReadOnlyObjectProperty<Insets> labelPaddingProperty
- Default value:
Insets.EMPTY- See Also:
graphicTextGap
public final DoubleProperty graphicTextGapProperty
- Default value:
- 4
- See Also:
textFill
public final ObjectProperty<Paint> textFillProperty
Paint used to fill the text.- Default value:
Color.BLACK- See Also:
mnemonicParsing
public final BooleanProperty mnemonicParsingProperty
- Default value:
-
false;truefor someControls. - See Also:
textTruncated
public final ReadOnlyBooleanProperty textTruncatedProperty
When truncated, the ellipsisString gets inserted in the place dictated by the textOverrun property.
- Since:
- 23
- See Also:
Constructor Details
Labeled
public Labeled()
Labeled
public Labeled(String text)
- Parameters:
-
text- The text for the label.
Labeled
public Labeled(String text, Node graphic)
- Parameters:
-
text- The text for the label. -
graphic- The graphic for the label.
Method Details
textProperty
public final StringProperty textProperty()
- Default value:
- empty string
- Returns:
- the text to display in the label
- See Also:
setText
public final void setText(String value)
text property.- Property description:
- The text to display in the label. The text may be null.
- Default value:
- empty string
- Parameters:
-
value- the value for thetextproperty - See Also:
getText
public final String getText()
text property.- Property description:
- The text to display in the label. The text may be null.
- Default value:
- empty string
- Returns:
- the value of the
textproperty - See Also:
alignmentProperty
public final ObjectProperty<Pos> alignmentProperty()
- Default value:
Pos.CENTER_LEFT- Returns:
- the alignment within this labeled
- See Also:
setAlignment
public final void setAlignment(Pos value)
alignment property.- Property description:
- Specifies how the text and graphic within the Labeled should be aligned when there is empty space within the Labeled.
- Default value:
Pos.CENTER_LEFT- Parameters:
-
value- the value for thealignmentproperty - See Also:
getAlignment
public final Pos getAlignment()
alignment property.- Property description:
- Specifies how the text and graphic within the Labeled should be aligned when there is empty space within the Labeled.
- Default value:
Pos.CENTER_LEFT- Returns:
- the value of the
alignmentproperty - See Also:
textAlignmentProperty
public final ObjectProperty<TextAlignment> textAlignmentProperty()
contentDisplayProperty() which affects the graphic and text, this setting only affects multiple lines of text relative to the text bounds.- Default value:
TextAlignment.LEFT- Returns:
- the alignment of lines of text within this labeled
- See Also:
setTextAlignment
public final void setTextAlignment(TextAlignment value)
textAlignment property.- Property description:
- Specifies the behavior for lines of text when text is multiline. Unlike
contentDisplayProperty()which affects the graphic and text, this setting only affects multiple lines of text relative to the text bounds. - Default value:
TextAlignment.LEFT- Parameters:
-
value- the value for thetextAlignmentproperty - See Also:
getTextAlignment
public final TextAlignment getTextAlignment()
textAlignment property.- Property description:
- Specifies the behavior for lines of text when text is multiline. Unlike
contentDisplayProperty()which affects the graphic and text, this setting only affects multiple lines of text relative to the text bounds. - Default value:
TextAlignment.LEFT- Returns:
- the value of the
textAlignmentproperty - See Also:
textOverrunProperty
public final ObjectProperty<OverrunStyle> textOverrunProperty()
Labeled exceeds the available space for rendering the text.- Default value:
OverrunStyle.ELLIPSIS- Returns:
- the overrun behavior if the text exceeds the available space
- See Also:
setTextOverrun
public final void setTextOverrun(OverrunStyle value)
textOverrun property.- Property description:
- Specifies the behavior to use if the text of the
Labeledexceeds the available space for rendering the text. - Default value:
OverrunStyle.ELLIPSIS- Parameters:
-
value- the value for thetextOverrunproperty - See Also:
getTextOverrun
public final OverrunStyle getTextOverrun()
textOverrun property.- Property description:
- Specifies the behavior to use if the text of the
Labeledexceeds the available space for rendering the text. - Default value:
OverrunStyle.ELLIPSIS- Returns:
- the value of the
textOverrunproperty - See Also:
ellipsisStringProperty
public final StringProperty ellipsisStringProperty()
| Examples | |
|---|---|
| "..." | Default value for most locales |
| " . . . " | |
| " [...] " | |
| "\u2026" | The Unicode ellipsis character '…' |
| "" | No ellipsis, just display the truncated string |
Note that not all fonts support all Unicode characters.
- Default value:
"..."- Returns:
- the ellipsis property on the string to display for the ellipsis when text is truncated
- Since:
- JavaFX 2.2
- See Also:
setEllipsisString
public final void setEllipsisString(String value)
ellipsisString property.- Property description:
- Specifies the string to display for the ellipsis when text is truncated.
Ellipsis Table Examples "..." Default value for most locales " . . . " " [...] " "\u2026" The Unicode ellipsis character '…' "" No ellipsis, just display the truncated string Note that not all fonts support all Unicode characters.
- Default value:
"..."- Parameters:
-
value- the value for theellipsisStringproperty - Since:
- JavaFX 2.2
- See Also:
getEllipsisString
public final String getEllipsisString()
ellipsisString property.- Property description:
- Specifies the string to display for the ellipsis when text is truncated.
Ellipsis Table Examples "..." Default value for most locales " . . . " " [...] " "\u2026" The Unicode ellipsis character '…' "" No ellipsis, just display the truncated string Note that not all fonts support all Unicode characters.
- Default value:
"..."- Returns:
- the value of the
ellipsisStringproperty - Since:
- JavaFX 2.2
- See Also:
wrapTextProperty
public final BooleanProperty wrapTextProperty()
- Default value:
false- Returns:
- the wrap property if a run of text exceeds the width of the Labeled
- See Also:
setWrapText
public final void setWrapText(boolean value)
wrapText property.- Property description:
- If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line.
- Default value:
false- Parameters:
-
value- the value for thewrapTextproperty - See Also:
isWrapText
public final boolean isWrapText()
wrapText property.- Property description:
- If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line.
- Default value:
false- Returns:
- the value of the
wrapTextproperty - See Also:
getContentBias
public Orientation getContentBias()
- Overrides:
-
getContentBiasin classNode - Returns:
- orientation of width/height dependency or null if there is none
- See Also:
fontProperty
public final ObjectProperty<Font> fontProperty()
- Default value:
Font.getDefault()- Returns:
- the default font to use for text in this labeled
- See Also:
setFont
public final void setFont(Font value)
font property.- Property description:
- The default font to use for text in the Labeled. If the Label's text is rich text then this font may or may not be used depending on the font information embedded in the rich text, but in any case where a default font is required, this font will be used.
- Default value:
Font.getDefault()- Parameters:
-
value- the value for thefontproperty - See Also:
getFont
public final Font getFont()
font property.- Property description:
- The default font to use for text in the Labeled. If the Label's text is rich text then this font may or may not be used depending on the font information embedded in the rich text, but in any case where a default font is required, this font will be used.
- Default value:
Font.getDefault()- Returns:
- the value of the
fontproperty - See Also:
graphicProperty
public final ObjectProperty<Node> graphicProperty()
setContentDisplay(javafx.scene.control.ContentDisplay). The node specified for this variable cannot appear elsewhere in the scene graph, otherwise the IllegalArgumentException is thrown. See the class description of Node for more detail.- Default value:
null- Returns:
- the optional icon for this labeled
- See Also:
setGraphic
public final void setGraphic(Node value)
graphic property.- Property description:
- An optional icon for the Labeled. This can be positioned relative to the text by using
setContentDisplay(javafx.scene.control.ContentDisplay). The node specified for this variable cannot appear elsewhere in the scene graph, otherwise theIllegalArgumentExceptionis thrown. See the class description ofNodefor more detail. - Default value:
null- Parameters:
-
value- the value for thegraphicproperty - See Also:
getGraphic
public final Node getGraphic()
graphic property.- Property description:
- An optional icon for the Labeled. This can be positioned relative to the text by using
setContentDisplay(javafx.scene.control.ContentDisplay). The node specified for this variable cannot appear elsewhere in the scene graph, otherwise theIllegalArgumentExceptionis thrown. See the class description ofNodefor more detail. - Default value:
null- Returns:
- the value of the
graphicproperty - See Also:
underlineProperty
public final BooleanProperty underlineProperty()
- Default value:
false- Returns:
- the underline property of all text in this labeled
- See Also:
setUnderline
public final void setUnderline(boolean value)
underline property.- Property description:
- Whether all text should be underlined.
- Default value:
false- Parameters:
-
value- the value for theunderlineproperty - See Also:
isUnderline
public final boolean isUnderline()
underline property.- Property description:
- Whether all text should be underlined.
- Default value:
false- Returns:
- the value of the
underlineproperty - See Also:
lineSpacingProperty
public final DoubleProperty lineSpacingProperty()
- Default value:
- 0
- Returns:
- the line spacing property between lines in this labeled
- Since:
- JavaFX 8.0
- See Also:
setLineSpacing
public final void setLineSpacing(double value)
lineSpacing property.- Property description:
- Specifies the space in pixel between lines.
- Default value:
- 0
- Parameters:
-
value- the value for thelineSpacingproperty - Since:
- JavaFX 8.0
- See Also:
getLineSpacing
public final double getLineSpacing()
lineSpacing property.- Property description:
- Specifies the space in pixel between lines.
- Default value:
- 0
- Returns:
- the value of the
lineSpacingproperty - Since:
- JavaFX 8.0
- See Also:
contentDisplayProperty
public final ObjectProperty<ContentDisplay> contentDisplayProperty()
- Default value:
ContentDisplay.LEFT- Returns:
- content display property of this labeled
- See Also:
setContentDisplay
public final void setContentDisplay(ContentDisplay value)
contentDisplay property.- Property description:
- Specifies the positioning of the graphic relative to the text.
- Default value:
ContentDisplay.LEFT- Parameters:
-
value- the value for thecontentDisplayproperty - See Also:
getContentDisplay
public final ContentDisplay getContentDisplay()
contentDisplay property.- Property description:
- Specifies the positioning of the graphic relative to the text.
- Default value:
ContentDisplay.LEFT- Returns:
- the value of the
contentDisplayproperty - See Also:
labelPaddingProperty
public final ReadOnlyObjectProperty<Insets> labelPaddingProperty()
- Default value:
Insets.EMPTY- Returns:
- the label padding property of this labeled
- See Also:
getLabelPadding
public final Insets getLabelPadding()
labelPadding property.- Property description:
- The padding around the Labeled's text and graphic content. By default labelPadding is Insets.EMPTY and cannot be set to null. Subclasses may add nodes outside this padding and inside the Labeled's padding. This property can only be set from CSS.
- Default value:
Insets.EMPTY- Returns:
- the value of the
labelPaddingproperty - See Also:
graphicTextGapProperty
public final DoubleProperty graphicTextGapProperty()
- Default value:
- 4
- Returns:
- the graphics text gap property of this labeled
- See Also:
setGraphicTextGap
public final void setGraphicTextGap(double value)
graphicTextGap property.- Property description:
- The amount of space between the graphic and text
- Default value:
- 4
- Parameters:
-
value- the value for thegraphicTextGapproperty - See Also:
getGraphicTextGap
public final double getGraphicTextGap()
graphicTextGap property.- Property description:
- The amount of space between the graphic and text
- Default value:
- 4
- Returns:
- the value of the
graphicTextGapproperty - See Also:
setTextFill
public final void setTextFill(Paint value)
textFill property.- Property description:
- The
Paintused to fill the text. - Default value:
Color.BLACK- Parameters:
-
value- the value for thetextFillproperty - See Also:
getTextFill
public final Paint getTextFill()
textFill property.- Property description:
- The
Paintused to fill the text. - Default value:
Color.BLACK- Returns:
- the value of the
textFillproperty - See Also:
textFillProperty
public final ObjectProperty<Paint> textFillProperty()
Paint used to fill the text.- Default value:
Color.BLACK- Returns:
- the
textFillproperty - See Also:
setMnemonicParsing
public final void setMnemonicParsing(boolean value)
mnemonicParsing property.- Property description:
- MnemonicParsing property to enable/disable text parsing. If this is set to true, then the Label text will be parsed to see if it contains the mnemonic parsing character '_'. When a mnemonic is detected the key combination will be determined based on the succeeding character, and the mnemonic added.
- Default value:
-
false;truefor someControls. - Parameters:
-
value- the value for themnemonicParsingproperty - See Also:
isMnemonicParsing
public final boolean isMnemonicParsing()
mnemonicParsing property.- Property description:
- MnemonicParsing property to enable/disable text parsing. If this is set to true, then the Label text will be parsed to see if it contains the mnemonic parsing character '_'. When a mnemonic is detected the key combination will be determined based on the succeeding character, and the mnemonic added.
- Default value:
-
false;truefor someControls. - Returns:
- the value of the
mnemonicParsingproperty - See Also:
mnemonicParsingProperty
public final BooleanProperty mnemonicParsingProperty()
- Default value:
-
false;truefor someControls. - Returns:
- the
mnemonicParsingproperty - See Also:
textTruncatedProperty
public final ReadOnlyBooleanProperty textTruncatedProperty()
When truncated, the ellipsisString gets inserted in the place dictated by the textOverrun property.
- Returns:
- the
textTruncatedproperty - Since:
- 23
- See Also:
isTextTruncated
public final boolean isTextTruncated()
textTruncated property.- Property description:
- Indicates whether the text has been truncated because it cannot fit into the available width.
When truncated, the
ellipsisStringgets inserted in the place dictated by thetextOverrunproperty. - Returns:
- the value of the
textTruncatedproperty - Since:
- 23
- See Also:
getInitialAlignment
protected Pos getInitialAlignment()
- Returns:
- the initial alignment state of this control
- Since:
- 9
getClassCssMetaData
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
CssMetaData associated with this class, which may include the CssMetaData of its superclasses.- Returns:
- the
CssMetaData - Since:
- JavaFX 8.0
getControlCssMetaData
public List<CssMetaData<? extends Styleable,?>> getControlCssMetaData()
- Overrides:
-
getControlCssMetaDatain classControl - Returns:
- the unmodifiable list of the control's CSS-styleable properties
- Since:
- JavaFX 8.0
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.