- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.layout.Pane
-
- javafx.scene.text.TextFlow
-
- すべての実装されたインタフェース:
Styleable
,EventTarget
public class TextFlow extends Pane
TextFlowは、リッチ・テキストをレイアウトするように設計された特殊レイアウトです。 これは、複数のText
ノードを単一のテキスト・フローにレイアウトするために使用できます。 TextFlowは、その内側にある各Text
ノードのテキストとフォント、およびそれ自体の幅とテキスト位置を使用して、それぞれの子の位置を決定します。 単一のText
ノードが折返しのために数行にまたがる場合や、Text
ノードの視覚的な位置が、双方向の並替えのために論理位置とは異なる場合があります。Text以外のすべてのノードは、テキスト・レイアウトの埋込みオブジェクトとして扱われます。 これは、優先幅、優先高および優先ベースライン・オフセットを使用して、コンテンツに挿入されます。
Text
ノードがTextFlow内にあるとき、一部のプロパティが無視されます。 たとえば、Text
ノードの場所は親によって決定されるため、ノードのxプロパティおよびyプロパティは無視されます。 同様に、折返しに使用される幅はTextFlowの幅であるため、Text
ノードの折返し幅も無視されます。Text
がTextFlowによってレイアウトされるときには、そのpickOnBounds
プロパティの値はfalse
に設定されます。 このようになるのは、(通常は改行および双方向の並替えのために)単一のText
ノードのコンテンツを分割してそれぞれをTextFlowの異なる場所に配置できるためです。レイアウトの折返し幅は、リージョンの現在の幅によって決定されます。 これは、アプリケーションでTextFlowの優先幅を設定することによって指定できます。 折返しが必要ない場合、アプリケーションでDouble.MAX_VALUEまたはRegion.USE_COMPUTED_SIZEに優先幅を設定できます。
段落は、
\n
で区切られ、Textの子に存在します。TextFlowの例:
Text text1 = new Text("Big italic red text"); text1.setFill(Color.RED); text1.setFont(Font.font("Helvetica", FontPosture.ITALIC, 40)); Text text2 = new Text(" little bold blue text"); text2.setFill(Color.BLUE); text2.setFont(Font.font("Helvetica", FontWeight.BOLD, 10)); TextFlow textFlow = new TextFlow(text1, text2);
TextFlowは、各管理対象の子をその子の可視プロパティ値に関係なくレイアウトします。管理対象外の子は、すべてのレイアウト計算で無視されます。
CSSを使用してTextFlowの背景とボーダーのスタイルを設定できる場合があります。 詳細は、
Region
スーパー・クラスを参照してください。サイズ変更可能な範囲
TextFlowの親は、レイアウトする際にTextFlowの範囲内でTextFlowをサイズ変更します。 デフォルトでは、TextFlowは次の表に示すようにコンテンツに基づいてこの範囲を計算します。
TextFlowサイズ変更表 width height 最小 左/右の枠 上/下の枠+テキスト・コンテンツの高さ 優先 左/右の枠+テキスト・コンテンツの幅 上/下の枠+テキスト・コンテンツの高さ 最大 Double.MAX_VALUE Double.MAX_VALUE TextFlowの最大幅および最大高には制限がないため、親に割り当てられているスペースすべてを満たすために、親がその優先サイズより大きいサイズに変更される可能性があります。
TextFlowには、サイズ範囲を直接設定するためのプロパティがあります。 これらのプロパティのデフォルトはセンチネル値Region.USE_COMPUTED_SIZEになりますが、アプリケーションで、必要に応じて、次のような他の値に設定できます。
アプリケーションでは、これらのプロパティをRegion.USE_COMPUTED_SIZEに戻すことによって、計算値をリストアできます。textflow.setMaxWidth(500);
TextFlowはデフォルトではそのコンテンツをクリップしないため、子の優先サイズが、textflowが子に割り当てる必要があるスペースより大きい場合、子の境界がtextflow自体の境界の外側まで拡大することがあります。
- 導入されたバージョン:
- JavaFX 8.0
-
-
プロパティのサマリー
プロパティ Type プロパティ 説明 DoubleProperty
lineSpacing
行間のピクセル単位の垂直方向の総スペースを定義します。ObjectProperty<TextAlignment>
textAlignment
水平方向のテキスト位置を定義します。-
クラス javafx.scene.Nodeで宣言されたプロパティ
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, 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
-
クラス javafx.scene.Parentで宣言されたプロパティ
needsLayout
-
クラス javafx.scene.layout.Regionで宣言されたプロパティ
background、border、cacheShape、centerShape、height、insets、maxHeight、maxWidth、minHeight、minWidth、opaqueInsets、padding、prefHeight、prefWidth、scaleShape、shape、snapToPixel、width
-
-
フィールドのサマリー
-
クラス javafx.scene.Nodeで宣言されたフィールド
BASELINE_OFFSET_SAME_AS_HEIGHT
-
クラス javafx.scene.layout.Regionで宣言されたフィールド
USE_COMPUTED_SIZE、USE_PREF_SIZE
-
-
メソッドのサマリー
すべてのメソッド 静的メソッド インスタンス・メソッド 具象メソッド 修飾子と型 メソッド 説明 PathElement[]
caretShape(int charIndex, boolean leading)
キャレットのシェイプをローカル座標で返します。static List<CssMetaData<? extends Styleable,?>>
getClassCssMetaData()
double
getLineSpacing()
プロパティlineSpacingの値を取得します。TextAlignment
getTextAlignment()
プロパティtextAlignmentの値を取得します。HitInfo
hitTest(Point2D point)
ローカル・ポイントをコンテンツのインデックスにマップします。DoubleProperty
lineSpacingProperty()
行間のピクセル単位の垂直方向の総スペースを定義します。PathElement[]
rangeShape(int start, int end)
ローカル座標のテキストの範囲のシェイプを返します。void
setLineSpacing(double spacing)
プロパティlineSpacingの値を設定します。void
setTextAlignment(TextAlignment value)
プロパティtextAlignmentの値を設定します。ObjectProperty<TextAlignment>
textAlignmentProperty()
水平方向のテキスト位置を定義します。-
クラス 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, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, 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, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, 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, 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
-
クラス java.lang.Objectで宣言されたメソッド
clone、equals、finalize、getClass、hashCode、notify、notifyAll、wait、wait、wait
-
クラス javafx.scene.layout.Paneで宣言されたメソッド
getChildren
-
クラス javafx.scene.Parentで宣言されたメソッド
getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
-
クラス javafx.scene.layout.Regionで宣言されたメソッド
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBackground, getBorder, getCssMetaData, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, 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
-
インタフェース javafx.css.Styleableで宣言されたメソッド
getStyleableNode, getStyleClass
-
-
-
-
プロパティの詳細
-
textAlignment
public final ObjectProperty<TextAlignment> textAlignmentProperty
水平方向のテキスト位置を定義します。- デフォルト値:
- TextAlignment.LEFT
- 関連項目:
getTextAlignment()
、setTextAlignment(TextAlignment)
-
lineSpacing
public final DoubleProperty lineSpacingProperty
行間のピクセル単位の垂直方向の総スペースを定義します。- デフォルト値:
- 0
- 導入されたバージョン:
- JavaFX 8.0
- 関連項目:
getLineSpacing()
、setLineSpacing(double)
-
-
コンストラクタの詳細
-
TextFlow
public TextFlow()
空のTextFlowレイアウトを作成します。
-
TextFlow
public TextFlow(Node... children)
指定された子を持つTextFlowレイアウトを作成します。- パラメータ:
children
- 子。
-
-
メソッドの詳細
-
hitTest
public final HitInfo hitTest(Point2D point)
ローカル・ポイントをコンテンツのインデックスにマップします。- パラメータ:
point
- テストされる指定された点- 戻り値:
- 見つかった文字インデックスを表す
HitInfo
- 導入されたバージョン:
- 9
-
caretShape
public PathElement[] caretShape(int charIndex, boolean leading)
キャレットのシェイプをローカル座標で返します。- パラメータ:
charIndex
- キャレットの文字インデックスleading
- キャレットが文字の先端に偏っているかどうか- 戻り値:
Shape
の作成に使用できるPathElement
の配列- 導入されたバージョン:
- 9
-
rangeShape
public final PathElement[] rangeShape(int start, int end)
ローカル座標のテキストの範囲のシェイプを返します。- パラメータ:
start
- 範囲の先頭の文字インデックスend
- 範囲の終了文字インデックス(non-inclusive)- 戻り値:
Shape
の作成に使用できるPathElement
の配列- 導入されたバージョン:
- 9
-
setTextAlignment
public final void setTextAlignment(TextAlignment value)
プロパティtextAlignmentの値を設定します。- プロパティの説明:
- 水平方向のテキスト位置を定義します。
- デフォルト値:
- TextAlignment.LEFT
-
getTextAlignment
public final TextAlignment getTextAlignment()
プロパティtextAlignmentの値を取得します。- プロパティの説明:
- 水平方向のテキスト位置を定義します。
- デフォルト値:
- TextAlignment.LEFT
-
textAlignmentProperty
public final ObjectProperty<TextAlignment> textAlignmentProperty()
水平方向のテキスト位置を定義します。- デフォルト値:
- TextAlignment.LEFT
- 関連項目:
getTextAlignment()
、setTextAlignment(TextAlignment)
-
setLineSpacing
public final void setLineSpacing(double spacing)
プロパティlineSpacingの値を設定します。- プロパティの説明:
- 行間のピクセル単位の垂直方向の総スペースを定義します。
- デフォルト値:
- 0
- 導入されたバージョン:
- JavaFX 8.0
-
getLineSpacing
public final double getLineSpacing()
プロパティlineSpacingの値を取得します。- プロパティの説明:
- 行間のピクセル単位の垂直方向の総スペースを定義します。
- デフォルト値:
- 0
- 導入されたバージョン:
- JavaFX 8.0
-
lineSpacingProperty
public final DoubleProperty lineSpacingProperty()
行間のピクセル単位の垂直方向の総スペースを定義します。- デフォルト値:
- 0
- 導入されたバージョン:
- JavaFX 8.0
- 関連項目:
getLineSpacing()
、setLineSpacing(double)
-
getClassCssMetaData
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
- 戻り値:
- このクラスに関連付けられたCssMetaData。スーパークラスのCssMetaDataを含むことがあります。
-
-