Spec-Zone .ru
спецификации, руководства, описания, API
|
@DefaultProperty(value="text") public class Text extends Shape
Text
class defines a node that displays a text.
Paragraphs are separated by '\n'
and the text is wrapped on
paragraph boundaries.
import javafx.scene.text.*; Text t = new Text(10, 50, "This is a test"); t.setFont(new Font(20));
import javafx.scene.text.*; Text t = new Text(); text.setFont(new Font(20)); text.setText("First row\nSecond row");
import javafx.scene.text.*; Text t = new Text(); text.setFont(new Font(20)); text.setWrappingWidth(200); text.setTextAlignment(TextAlignment.JUSTIFY) text.setText("The quick brown fox jumps over the lazy dog");
Type | Property and Description |
---|---|
ReadOnlyDoubleProperty |
baselineOffset
The 'alphabetic' (or roman) baseline offset from the Text node's
layoutBounds.minY location.
|
ObjectProperty<TextBoundsType> |
boundsType
Determines how the bounds of the text node are calculated.
|
ObjectProperty<Font> |
font
Defines the font of text.
|
ObjectProperty<FontSmoothingType> |
fontSmoothingType
Specifies a requested font smoothing type : gray or LCD.
|
BooleanProperty |
strikethrough
Defines if each line of text should have a line through it.
|
ObjectProperty<TextAlignment> |
textAlignment
Defines horizontal text alignment in the bounding box.
|
ObjectProperty<VPos> |
textOrigin
Defines the origin of text coordinate system in local coordinates.
|
StringProperty |
text
Defines text string that is to be displayed.
|
BooleanProperty |
underline
Defines if each line of text should have a line below it.
|
DoubleProperty |
wrappingWidth
Defines a width constraint for the text in user space coordinates,
e.g.
|
DoubleProperty |
x
Defines the X coordinate of text origin.
|
DoubleProperty |
y
Defines the Y coordinate of text origin.
|
fill, smooth, strokeDashOffset, strokeLineCap, strokeLineJoin, strokeMiterLimit, stroke, strokeType, strokeWidth
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
Constructor and Description |
---|
Text()
Creates an empty instance of Text.
|
Text(double x,
double y,
java.lang.String text)
Creates an instance of Text on the given coordinates containing the
given string.
|
Text(java.lang.String text)
Creates an instance of Text containing the given string.
|
Modifier and Type | Method and Description |
---|---|
ReadOnlyDoubleProperty |
baselineOffsetProperty()
The 'alphabetic' (or roman) baseline offset from the Text node's
layoutBounds.minY location.
|
ObjectProperty<TextBoundsType> |
boundsTypeProperty()
Determines how the bounds of the text node are calculated.
|
ObjectProperty<Font> |
fontProperty()
Defines the font of text.
|
ObjectProperty<FontSmoothingType> |
fontSmoothingTypeProperty()
Specifies a requested font smoothing type : gray or LCD.
|
double |
getBaselineOffset()
Gets the value of the property baselineOffset.
|
TextBoundsType |
getBoundsType()
Gets the value of the property boundsType.
|
Font |
getFont()
Gets the value of the property font.
|
FontSmoothingType |
getFontSmoothingType()
Gets the value of the property fontSmoothingType.
|
java.lang.String |
getText()
Gets the value of the property text.
|
TextAlignment |
getTextAlignment()
Gets the value of the property textAlignment.
|
VPos |
getTextOrigin()
Gets the value of the property textOrigin.
|
double |
getWrappingWidth()
Gets the value of the property wrappingWidth.
|
double |
getX()
Gets the value of the property x.
|
double |
getY()
Gets the value of the property y.
|
boolean |
isStrikethrough()
Gets the value of the property strikethrough.
|
boolean |
isUnderline()
Gets the value of the property underline.
|
void |
setBoundsType(TextBoundsType value)
Sets the value of the property boundsType.
|
void |
setFont(Font value)
Sets the value of the property font.
|
void |
setFontSmoothingType(FontSmoothingType value)
Sets the value of the property fontSmoothingType.
|
void |
setStrikethrough(boolean value)
Sets the value of the property strikethrough.
|
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 |
setTextOrigin(VPos value)
Sets the value of the property textOrigin.
|
void |
setUnderline(boolean value)
Sets the value of the property underline.
|
void |
setWrappingWidth(double value)
Sets the value of the property wrappingWidth.
|
void |
setX(double value)
Sets the value of the property x.
|
void |
setY(double value)
Sets the value of the property y.
|
BooleanProperty |
strikethroughProperty()
Defines if each line of text should have a line through it.
|
ObjectProperty<TextAlignment> |
textAlignmentProperty()
Defines horizontal text alignment in the bounding box.
|
ObjectProperty<VPos> |
textOriginProperty()
Defines the origin of text coordinate system in local coordinates.
|
StringProperty |
textProperty()
Defines text string that is to be displayed.
|
BooleanProperty |
underlineProperty()
Defines if each line of text should have a line below it.
|
DoubleProperty |
wrappingWidthProperty()
Defines a width constraint for the text in user space coordinates,
e.g.
|
DoubleProperty |
xProperty()
Defines the X coordinate of text origin.
|
DoubleProperty |
yProperty()
Defines the Y coordinate of text origin.
|
fillProperty, getFill, getStroke, getStrokeDashArray, getStrokeDashOffset, getStrokeLineCap, getStrokeLineJoin, getStrokeMiterLimit, getStrokeType, getStrokeWidth, intersect, isSmooth, setFill, setSmooth, setStroke, setStrokeDashOffset, setStrokeLineCap, setStrokeLineJoin, setStrokeMiterLimit, setStrokeType, setStrokeWidth, smoothProperty, strokeDashOffsetProperty, strokeLineCapProperty, strokeLineJoinProperty, strokeMiterLimitProperty, strokeProperty, strokeTypeProperty, strokeWidthProperty, subtract, union
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, getContentBias, 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, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToSceneTransformProperty, lookup, lookupAll, managedProperty, maxHeight, maxWidth, minHeight, minWidth, 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, prefHeight, prefWidth, pressedProperty, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, 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 DoubleProperty xProperty
getX()
,
setX(double)
public final DoubleProperty yProperty
getY()
,
setY(double)
public final ObjectProperty<Font> fontProperty
getFont()
,
setFont(Font)
public final ObjectProperty<VPos> textOriginProperty
VPos.BASELINE
and
VPos.TOP
define the origin of the top row while
VPos.BOTTOM
defines the origin of the bottom row.getTextOrigin()
,
setTextOrigin(VPos)
public final ObjectProperty<TextBoundsType> boundsTypeProperty
TextBoundsType
for more information.getBoundsType()
,
setBoundsType(TextBoundsType)
public final DoubleProperty wrappingWidthProperty
> 0
text will be line wrapped as needed
to satisfy this constraint.getWrappingWidth()
,
setWrappingWidth(double)
public final BooleanProperty underlineProperty
isUnderline()
,
setUnderline(boolean)
public final BooleanProperty strikethroughProperty
isStrikethrough()
,
setStrikethrough(boolean)
public final ObjectProperty<TextAlignment> textAlignmentProperty
getTextAlignment()
,
setTextAlignment(TextAlignment)
public final ReadOnlyDoubleProperty baselineOffsetProperty
getBaselineOffset()
public final ObjectProperty<FontSmoothingType> fontSmoothingTypeProperty
getFontSmoothingType()
,
setFontSmoothingType(FontSmoothingType)
public Text()
public Text(java.lang.String text)
text
- text to be contained in the instancepublic Text(double x, double y, java.lang.String text)
x
- the horizontal position of the texty
- the vertical position of the texttext
- text to be contained in the instancepublic final void setText(java.lang.String value)
public final java.lang.String getText()
public final StringProperty textProperty()
getText()
,
setText(String)
public final void setX(double value)
public final double getX()
public final DoubleProperty xProperty()
getX()
,
setX(double)
public final void setY(double value)
public final double getY()
public final DoubleProperty yProperty()
getY()
,
setY(double)
public final void setFont(Font value)
public final Font getFont()
public final ObjectProperty<Font> fontProperty()
getFont()
,
setFont(Font)
public final void setTextOrigin(VPos value)
VPos.BASELINE
and
VPos.TOP
define the origin of the top row while
VPos.BOTTOM
defines the origin of the bottom row.public final VPos getTextOrigin()
VPos.BASELINE
and
VPos.TOP
define the origin of the top row while
VPos.BOTTOM
defines the origin of the bottom row.public final ObjectProperty<VPos> textOriginProperty()
VPos.BASELINE
and
VPos.TOP
define the origin of the top row while
VPos.BOTTOM
defines the origin of the bottom row.getTextOrigin()
,
setTextOrigin(VPos)
public final void setBoundsType(TextBoundsType value)
TextBoundsType
for more information.public final TextBoundsType getBoundsType()
TextBoundsType
for more information.public final ObjectProperty<TextBoundsType> boundsTypeProperty()
TextBoundsType
for more information.getBoundsType()
,
setBoundsType(TextBoundsType)
public final void setWrappingWidth(double value)
> 0
text will be line wrapped as needed
to satisfy this constraint.public final double getWrappingWidth()
> 0
text will be line wrapped as needed
to satisfy this constraint.public final DoubleProperty wrappingWidthProperty()
> 0
text will be line wrapped as needed
to satisfy this constraint.getWrappingWidth()
,
setWrappingWidth(double)
public final void setUnderline(boolean value)
public final boolean isUnderline()
public final BooleanProperty underlineProperty()
isUnderline()
,
setUnderline(boolean)
public final void setStrikethrough(boolean value)
public final boolean isStrikethrough()
public final BooleanProperty strikethroughProperty()
isStrikethrough()
,
setStrikethrough(boolean)
public final void setTextAlignment(TextAlignment value)
public final TextAlignment getTextAlignment()
public final ObjectProperty<TextAlignment> textAlignmentProperty()
getTextAlignment()
,
setTextAlignment(TextAlignment)
public final double getBaselineOffset()
getBaselineOffset
in class Node
public final ReadOnlyDoubleProperty baselineOffsetProperty()
getBaselineOffset()
public final void setFontSmoothingType(FontSmoothingType value)
public final FontSmoothingType getFontSmoothingType()
public final ObjectProperty<FontSmoothingType> fontSmoothingTypeProperty()
getFontSmoothingType()
,
setFontSmoothingType(FontSmoothingType)
Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to