Spec-Zone .ru
спецификации, руководства, описания, API
|
@DefaultProperty(value="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);
Button
,
Label
,
ToggleButton
Type | Property and Description |
---|---|
ObjectProperty<Pos> |
alignment
Specifies how the text and graphic within the Labeled should be
aligned when there is empty space within the Labeled.
|
ObjectProperty<ContentDisplay> |
contentDisplay
Specifies the positioning of the graphic relative to the text.
|
StringProperty |
ellipsisString
Specifies the string to display for the ellipsis when text is truncated.
|
ObjectProperty<Font> |
font
The default font to use for text in the Labeled.
|
ObjectProperty<Node> |
graphic
An optional icon for the Labeled.
|
DoubleProperty |
graphicTextGap
The amount of space between the graphic and text
|
ReadOnlyObjectProperty<Insets> |
labelPadding
The padding around the Labeled's text and graphic content.
|
BooleanProperty |
mnemonicParsing
MnemonicParsing property to enable/disable text parsing.
|
ObjectProperty<TextAlignment> |
textAlignment
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. |
ObjectProperty<Paint> |
textFill
The
Paint used to fill the text. |
ObjectProperty<OverrunStyle> |
textOverrun
Specifies the behavior to use if the text of the
Labeled
exceeds the available space for rendering the text. |
StringProperty |
text
The text to display in the label.
|
BooleanProperty |
underline
Whether all text should be underlined.
|
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.
|
contextMenu, height, maxHeight, maxWidth, minHeight, minWidth, prefHeight, prefWidth, skinClassName, skin, tooltip, width
needsLayout
blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, 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, visible
USE_COMPUTED_SIZE, USE_PREF_SIZE
Constructor and Description |
---|
Labeled()
Creates a Label with no text and graphic
|
Labeled(java.lang.String text)
Creates a Label with text
|
Labeled(java.lang.String text,
Node graphic)
Creates a Label with text and a graphic
|
Modifier and Type | Method and Description |
---|---|
ObjectProperty<Pos> |
alignmentProperty()
Specifies how the text and graphic within the Labeled should be
aligned when there is empty space within the Labeled.
|
ObjectProperty<ContentDisplay> |
contentDisplayProperty()
Specifies the positioning of the graphic relative to the text.
|
StringProperty |
ellipsisStringProperty()
Specifies the string to display for the ellipsis when text is truncated.
|
ObjectProperty<Font> |
fontProperty()
The default font to use for text in the Labeled.
|
Pos |
getAlignment()
Gets the value of the property alignment.
|
Orientation |
getContentBias()
If wrapText is true, then contentBias will be HORIZONTAL, otherwise it is null.
|
ContentDisplay |
getContentDisplay()
Gets the value of the property contentDisplay.
|
java.lang.String |
getEllipsisString()
Gets the value of the property ellipsisString.
|
Font |
getFont()
Gets the value of the property font.
|
Node |
getGraphic()
Gets the value of the property graphic.
|
double |
getGraphicTextGap()
Gets the value of the property graphicTextGap.
|
Insets |
getLabelPadding()
Gets the value of the property labelPadding.
|
java.lang.String |
getText()
Gets the value of the property text.
|
TextAlignment |
getTextAlignment()
Gets the value of the property textAlignment.
|
Paint |
getTextFill()
Gets the value of the property textFill.
|
OverrunStyle |
getTextOverrun()
Gets the value of the property textOverrun.
|
ObjectProperty<Node> |
graphicProperty()
An optional icon for the Labeled.
|
DoubleProperty |
graphicTextGapProperty()
The amount of space between the graphic and text
|
boolean |
isMnemonicParsing()
Gets the value of the property mnemonicParsing.
|
boolean |
isUnderline()
Gets the value of the property underline.
|
boolean |
isWrapText()
Gets the value of the property wrapText.
|
ReadOnlyObjectProperty<Insets> |
labelPaddingProperty()
The padding around the Labeled's text and graphic content.
|
BooleanProperty |
mnemonicParsingProperty()
MnemonicParsing property to enable/disable text parsing.
|
void |
setAlignment(Pos value)
Sets the value of the property alignment.
|
void |
setContentDisplay(ContentDisplay value)
Sets the value of the property contentDisplay.
|
void |
setEllipsisString(java.lang.String value)
Sets the value of the property ellipsisString.
|
void |
setFont(Font value)
Sets the value of the property font.
|
void |
setGraphic(Node value)
Sets the value of the property graphic.
|
void |
setGraphicTextGap(double value)
Sets the value of the property graphicTextGap.
|
void |
setMnemonicParsing(boolean value)
Sets the value of the property mnemonicParsing.
|
void |
setText(java.lang.String value)
Sets the value of the property text.
|
void |
setTextAlignment(TextAlignment value)
Sets the value of the property textAlignment.
|
void |
setTextFill(Paint value)
Sets the value of the property textFill.
|
void |
setTextOverrun(OverrunStyle value)
Sets the value of the property textOverrun.
|
void |
setUnderline(boolean value)
Sets the value of the property underline.
|
void |
setWrapText(boolean value)
Sets the value of the property wrapText.
|
ObjectProperty<TextAlignment> |
textAlignmentProperty()
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. |
ObjectProperty<Paint> |
textFillProperty()
The
Paint used to fill the text. |
ObjectProperty<OverrunStyle> |
textOverrunProperty()
Specifies the behavior to use if the text of the
Labeled
exceeds the available space for rendering the text. |
StringProperty |
textProperty()
The text to display in the label.
|
BooleanProperty |
underlineProperty()
Whether all text should be underlined.
|
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.
|
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getHeight, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, getSkin, getTooltip, getUserAgentStylesheet, getWidth, heightProperty, intersects, isResizable, layoutChildren, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, setContextMenu, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setPrefHeight, setPrefSize, setPrefWidth, setSkin, setSkinClassName, setTooltip, setWidth, skinClassNameProperty, skinProperty, tooltipProperty, widthProperty
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, setNeedsLayout
addEventFilter, addEventHandler, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getCursor, getDepthTest, getEffect, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, 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, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getUserData, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToSceneTransformProperty, lookupAll, managedProperty, mouseTransparentProperty, 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, pickOnBoundsProperty, pressedProperty, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, 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, visibleProperty
public final StringProperty textProperty
getText()
,
setText(String)
public final ObjectProperty<Pos> alignmentProperty
getAlignment()
,
setAlignment(Pos)
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.public final ObjectProperty<OverrunStyle> textOverrunProperty
Labeled
exceeds the available space for rendering the text.getTextOverrun()
,
setTextOverrun(OverrunStyle)
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.
getEllipsisString()
,
setEllipsisString(String)
public final BooleanProperty wrapTextProperty
isWrapText()
,
setWrapText(boolean)
public final ObjectProperty<Font> fontProperty
getFont()
,
setFont(Font)
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.getGraphic()
,
setGraphic(Node)
public final BooleanProperty underlineProperty
isUnderline()
,
setUnderline(boolean)
public final ObjectProperty<ContentDisplay> contentDisplayProperty
public final ReadOnlyObjectProperty<Insets> labelPaddingProperty
getLabelPadding()
public final DoubleProperty graphicTextGapProperty
getGraphicTextGap()
,
setGraphicTextGap(double)
public final ObjectProperty<Paint> textFillProperty
Paint
used to fill the text.getTextFill()
,
setTextFill(Paint)
public final BooleanProperty mnemonicParsingProperty
The default value for Labeled is false, but it is enabled by default on some Controls.
public Labeled()
public Labeled(java.lang.String text)
text
- The text for the label.public Labeled(java.lang.String text, Node graphic)
text
- The text for the label.graphic
- The graphic for the label.public final StringProperty textProperty()
getText()
,
setText(String)
public final void setText(java.lang.String value)
public final java.lang.String getText()
public final ObjectProperty<Pos> alignmentProperty()
getAlignment()
,
setAlignment(Pos)
public final void setAlignment(Pos value)
public final Pos getAlignment()
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.public final void setTextAlignment(TextAlignment value)
contentDisplayProperty()
which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds.public final TextAlignment getTextAlignment()
contentDisplayProperty()
which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds.public final ObjectProperty<OverrunStyle> textOverrunProperty()
Labeled
exceeds the available space for rendering the text.getTextOverrun()
,
setTextOverrun(OverrunStyle)
public final void setTextOverrun(OverrunStyle value)
Labeled
exceeds the available space for rendering the text.public final OverrunStyle getTextOverrun()
Labeled
exceeds the available space for rendering the text.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.
getEllipsisString()
,
setEllipsisString(String)
public final void setEllipsisString(java.lang.String value)
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.
public final java.lang.String getEllipsisString()
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.
public final BooleanProperty wrapTextProperty()
isWrapText()
,
setWrapText(boolean)
public final void setWrapText(boolean value)
public final boolean isWrapText()
public Orientation getContentBias()
getContentBias
in class Node
Node.isResizable()
,
Node.minWidth(double)
,
Node.minHeight(double)
,
Node.prefWidth(double)
,
Node.prefHeight(double)
,
Node.maxWidth(double)
,
Node.maxHeight(double)
public final ObjectProperty<Font> fontProperty()
getFont()
,
setFont(Font)
public final void setFont(Font value)
public final Font getFont()
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.getGraphic()
,
setGraphic(Node)
public final void setGraphic(Node value)
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.public final Node getGraphic()
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.public final BooleanProperty underlineProperty()
isUnderline()
,
setUnderline(boolean)
public final void setUnderline(boolean value)
public final boolean isUnderline()
public final ObjectProperty<ContentDisplay> contentDisplayProperty()
public final void setContentDisplay(ContentDisplay value)
public final ContentDisplay getContentDisplay()
public final ReadOnlyObjectProperty<Insets> labelPaddingProperty()
getLabelPadding()
public final Insets getLabelPadding()
public final DoubleProperty graphicTextGapProperty()
getGraphicTextGap()
,
setGraphicTextGap(double)
public final void setGraphicTextGap(double value)
public final double getGraphicTextGap()
public final void setTextFill(Paint value)
Paint
used to fill the text.public final Paint getTextFill()
Paint
used to fill the text.public final ObjectProperty<Paint> textFillProperty()
Paint
used to fill the text.getTextFill()
,
setTextFill(Paint)
public final void setMnemonicParsing(boolean value)
The default value for Labeled is false, but it is enabled by default on some Controls.
public final boolean isMnemonicParsing()
The default value for Labeled is false, but it is enabled by default on some Controls.
public final BooleanProperty mnemonicParsingProperty()
The default value for Labeled is false, but it is enabled by default on some Controls.
Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to