Spec-Zone .ru
спецификации, руководства, описания, API
|
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.
|
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.
|
contextMenuProperty, heightProperty, maxHeightProperty, maxWidthProperty, minHeightProperty, minWidthProperty, prefHeightProperty, prefWidthProperty, skinProperty, tooltipProperty, widthProperty
needsLayoutProperty
blendModeProperty, boundsInLocalProperty, boundsInParentProperty, cacheHintProperty, cacheProperty, clipProperty, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectProperty, eventDispatcherProperty, focusedProperty, focusTraversableProperty, hoverProperty, idProperty, inputMethodRequestsProperty, layoutBoundsProperty, layoutXProperty, layoutYProperty, managedProperty, mouseTransparentProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDraggedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onScrollProperty, opacityProperty, parentProperty, pickOnBoundsProperty, pressedProperty, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, styleProperty, translateXProperty, translateYProperty, translateZProperty, visibleProperty
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.
|
ObjectProperty<Font> |
fontProperty()
The default font to use for text in the Labeled.
|
Pos |
getAlignment()
Specifies how the text and graphic within the Labeled should be
aligned when there is empty space within the Labeled.
|
Orientation |
getContentBias()
If wrapText is true, then contentBias will be HORIZONTAL, otherwise it is null.
|
ContentDisplay |
getContentDisplay()
Specifies the positioning of the graphic relative to the text.
|
Font |
getFont()
The default font to use for text in the Labeled.
|
Node |
getGraphic()
An optional icon for the Labeled.
|
double |
getGraphicTextGap()
The amount of space between the graphic and text
|
Insets |
getLabelPadding()
The padding around the Labeled's text and graphic content.
|
java.lang.String |
getText()
The text to display in the label.
|
TextAlignment |
getTextAlignment()
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. |
Paint |
getTextFill()
The
Paint used to fill the text. |
OverrunStyle |
getTextOverrun()
Specifies the behavior to use if the text of the
Labeled
exceeds the available space for rendering the text. |
ObjectProperty<Node> |
graphicProperty()
An optional icon for the Labeled.
|
DoubleProperty |
graphicTextGapProperty()
The amount of space between the graphic and text
|
boolean |
isMnemonicParsing()
MnemonicParsing property to enable/disable text parsing.
|
boolean |
isUnderline()
Whether all text should be underlined.
|
boolean |
isWrapText()
If a run of text exceeds the width of the Labeled, then this variable
indicates whether the text should wrap onto another line.
|
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)
Specifies how the text and graphic within the Labeled should be
aligned when there is empty space within the Labeled.
|
void |
setContentDisplay(ContentDisplay value)
Specifies the positioning of the graphic relative to the text.
|
void |
setFont(Font value)
The default font to use for text in the Labeled.
|
void |
setGraphic(Node value)
An optional icon for the Labeled.
|
void |
setGraphicTextGap(double value)
The amount of space between the graphic and text
|
void |
setMnemonicParsing(boolean value)
MnemonicParsing property to enable/disable text parsing.
|
void |
setText(java.lang.String value)
The text to display in the label.
|
void |
setTextAlignment(TextAlignment value)
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. |
void |
setTextFill(Paint value)
The
Paint used to fill the text. |
void |
setTextOverrun(OverrunStyle value)
Specifies the behavior to use if the text of the
Labeled
exceeds the available space for rendering the text. |
void |
setUnderline(boolean value)
Whether all text should be underlined.
|
void |
setWrapText(boolean value)
If a run of text exceeds the width of the Labeled, then this variable
indicates whether the text should wrap onto another line.
|
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, setTooltip, setWidth, skinProperty, tooltipProperty, widthProperty
getChildren, getChildrenUnmodifiable, getManagedChildren, 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, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragged, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnScroll, 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, localToScene, localToScene, localToScene, lookupAll, managedProperty, mouseTransparentProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDraggedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onScrollProperty, 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, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragged, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnScroll, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, startDragAndDrop, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, visibleProperty
getText()
,
setText(String)
getAlignment()
,
setAlignment(Pos)
contentDisplayProperty()
which affects the graphic and text, this setting
only affects multiple lines of text relative to the text bounds.Labeled
exceeds the available space for rendering the text.getTextOverrun()
,
setTextOverrun(OverrunStyle)
isWrapText()
,
setWrapText(boolean)
getFont()
,
setFont(Font)
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)
isUnderline()
,
setUnderline(boolean)
getLabelPadding()
getGraphicTextGap()
,
setGraphicTextGap(double)
Paint
used to fill the text.getTextFill()
,
setTextFill(Paint)
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 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 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, 2011, Oracle and/or its affiliates. All rights reserved. Use is subject to