public class TextFlow extends Pane
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
スーパー・クラスを参照してください。
width | height | |
---|---|---|
最小 | 左/右の枠 | 上/下の枠+テキスト・コンテンツの高さ |
優先 | 左/右の枠+テキスト・コンテンツの幅 | 上/下の枠+テキスト・コンテンツの高さ |
最大 | Double.MAX_VALUE | Double.MAX_VALUE |
TextFlowの最大幅および最大高には制限がないため、親に割り当てられているスペースすべてを満たすために、親がその優先サイズより大きいサイズに変更される可能性があります。
TextFlowには、サイズ範囲を直接設定するためのプロパティがあります。これらのプロパティのデフォルトはセンチネル値Region.USE_COMPUTED_SIZEになりますが、アプリケーションで、必要に応じて、次のような他の値に設定できます。
textflow.setMaxWidth(500);
アプリケーションでは、これらのプロパティをRegion.USE_COMPUTED_SIZEに戻すことによって、計算値をリストアできます。
TextFlowはデフォルトではそのコンテンツをクリップしないため、子の優先サイズが、textflowが子に割り当てる必要があるスペースより大きい場合、子の境界がtextflow自体の境界の外側まで拡大することがあります。
Type | プロパティと説明 |
---|---|
DoubleProperty |
lineSpacing
行間のピクセル単位の垂直方向の総スペースを定義します。
|
ObjectProperty<TextAlignment> |
textAlignment
水平方向のテキスト位置を定義します。
|
background、border、cacheShape、centerShape、height、insets、maxHeight、maxWidth、minHeight、minWidth、opaqueInsets、padding、prefHeight、prefWidth、scaleShape、shape、snapToPixel、width
needsLayout
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、visible
USE_COMPUTED_SIZE、USE_PREF_SIZE
BASELINE_OFFSET_SAME_AS_HEIGHT
コンストラクタと説明 |
---|
TextFlow()
空のTextFlowレイアウトを作成します。
|
TextFlow(Node... children)
指定された子を持つTextFlowレイアウトを作成します。
|
修飾子と型 | メソッドと説明 |
---|---|
protected double |
computeMinHeight(double width)
このリージョンの最小高を計算します。
|
protected double |
computePrefHeight(double width)
指定された幅に対するこのリージョンの優先高を計算します。Regionのサブクラスでは、このメソッドをオーバーライドして、そのコンテンツおよびレイアウト手法に基づいて適切な値を返す必要があります。
|
protected double |
computePrefWidth(double height)
指定された高さに対するこのリージョンの優先幅を計算します。
|
double |
getBaselineOffset()
最初に管理される子に基づいて、ベースライン・オフセットを計算します。
|
static List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
Orientation |
getContentBias()
レイアウト用にノードのサイズ変更バイアスの向きを返します。
|
List<CssMetaData<? extends Styleable,?>> |
getCssMetaData()
NodeのCssMetaDataがリフレクションなしでアクセス可能になるように、このメソッドは
Node.getClassCssMetaData() に委任する必要があります。 |
double |
getLineSpacing()
プロパティlineSpacingの値を取得します。
|
TextAlignment |
getTextAlignment()
プロパティtextAlignmentの値を取得します。
|
protected void |
layoutChildren()
この
Parent の子をレイアウトするレイアウト・パス中に起動されます。 |
DoubleProperty |
lineSpacingProperty()
行間のピクセル単位の垂直方向の総スペースを定義します。
|
Object |
queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
このメソッドは、属性の値をリクエストするためにアシスティブ・テクノロジによって呼び出されます。
|
void |
requestLayout()
次のシーンがレンダリングされる前に実行するレイアウト・パスを要求します。
|
void |
setLineSpacing(double spacing)
プロパティlineSpacingの値を設定します。
|
void |
setTextAlignment(TextAlignment value)
プロパティtextAlignmentの値を設定します。
|
protected void |
setWidth(double value)
プロパティwidthの値を設定します。
|
ObjectProperty<TextAlignment> |
textAlignmentProperty()
水平方向のテキスト位置を定義します。
|
boolean |
usesMirroring()
ノードの向きが右から左の場合にノードをミラー化するかどうかを指定します。
|
getChildren
backgroundProperty、borderProperty、cacheShapeProperty、centerShapeProperty、computeMaxHeight、computeMaxWidth、computeMinWidth、getBackground、getBorder、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、shapeProperty、snappedBottomInset、snappedLeftInset、snappedRightInset、snappedTopInset、snapPosition、snapSize、snapSpace、snapToPixelProperty、widthProperty
getChildrenUnmodifiable、getManagedChildren、getStylesheets、isNeedsLayout、layout、lookup、needsLayoutProperty、requestParentLayout、setNeedsLayout、updateBounds
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、getCursor、getDepthTest、getEffect、getEffectiveNodeOrientation、getEventDispatcher、getId、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、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、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、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、setVisible、snapshot、snapshot、startDragAndDrop、startFullDrag、styleProperty、toBack、toFront、toString、translateXProperty、translateYProperty、translateZProperty、visibleProperty
public final ObjectProperty<TextAlignment> textAlignmentProperty
getTextAlignment()
、setTextAlignment(TextAlignment)
public final DoubleProperty lineSpacingProperty
getLineSpacing()
、setLineSpacing(double)
public TextFlow()
public TextFlow(Node... children)
children
- 子。public boolean usesMirroring()
Node
ノードがミラー化される場合は、起点が自動的に右上隅に移動され、ミラー化変換を使用して子がレイアウトされ、ノードが右から左に描画されます。ノードによっては、変換を使用せずに右から左に描画した方がよい場合があります。これらのノードに対してfalse
を指定すると、向きが右から左のときに自動変換が使用されなくなります。
usesMirroring
、クラス: Node
protected void setWidth(double value)
Region
protected double computePrefWidth(double height)
Region
computePrefWidth
、クラス: Region
height
- 推奨される幅がそれに依存する場合に使用する必要がある高さprotected double computePrefHeight(double width)
Region
computePrefHeight
、クラス: Region
width
- 推奨される高さがそれに依存する場合に使用する必要がある幅protected double computeMinHeight(double width)
Region
computeMinHeight
、クラス: Region
width
- 最小高が幅に依存する場合に使用する必要がある幅public void requestLayout()
Parent
この親がレイアウト・ルートまたは管理対象外のいずれかである場合は、シーンのダーティ・レイアウト・リストに直接追加されます。そうでない場合は、requestParentLayoutが起動されます。
requestLayout
、クラス: Parent
public Orientation getContentBias()
Node
Resizableのサブクラスはこのメソッドをオーバーライドし、適切な値を返す必要があります。
getContentBias
、クラス: Node
Node.isResizable()
、Node.minWidth(double)
、Node.minHeight(double)
、Node.prefWidth(double)
、Node.prefHeight(double)
、Node.maxWidth(double)
、Node.maxHeight(double)
protected void layoutChildren()
Parent
Parent
の子をレイアウトするレイアウト・パス中に起動されます。デフォルトでは、管理対象のサイズ変更可能なコンテンツのサイズをその優先サイズに合せて設定するのみで、ノードの配置は行われません。
サブクラスは必要に応じてこの関数をオーバーライドし、コンテンツをレイアウトする必要があります。
layoutChildren
、クラス: Parent
public final void setTextAlignment(TextAlignment value)
public final TextAlignment getTextAlignment()
public final ObjectProperty<TextAlignment> textAlignmentProperty()
getTextAlignment()
、setTextAlignment(TextAlignment)
public final void setLineSpacing(double spacing)
public final double getLineSpacing()
public final DoubleProperty lineSpacingProperty()
getLineSpacing()
、setLineSpacing(double)
public final double getBaselineOffset()
Parent
Node.getBaselineOffset()
を返します。getBaselineOffset
、クラス: Parent
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
Region
Node.getClassCssMetaData()
に委任する必要があります。getCssMetaData
、インタフェース: Styleable
getCssMetaData
、クラス: Region
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
Node
このメソッドは一般に、特定の役割に必要な属性を実装するためにサブクラスによってオーバーライドされます。
特定の属性が処理されない場合、スーパー・クラス実装を呼び出す必要があります。
queryAccessibleAttribute
、クラス: Parent
attribute
- リクエストされた属性parameters
- オプションのパラメータ・リストAccessibleAttribute
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.