- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.layout.Pane
-
- javafx.scene.layout.StackPane
-
- すべての実装されたインタフェース:
Styleable
,EventTarget
- 直系の既知のサブクラス:
TableHeaderRow
public class StackPane extends Pane
StackPaneは、下から上へのスタックに子をレイアウトします。子のZ順序は子リストの順序によって定義され、0番目の子が最下位、最後の子が最上位になります。 ボーダーまたは余白(あるいはその両方)が設定されている場合は、それらの枠内に子がレイアウトされます。
スタック・ペインでは、各子をサイズ変更してそのコンテンツ領域全体に表示するように試みます。 子をスタック・ペイン全体に表示できない(子がサイズ変更可能でないか、最大サイズによりそのようにできない)場合、子はalignmentプロパティ(デフォルト値はPos.CENTER)に基づいて領域内で位置合せされます。
StackPaneの例:
StackPane stack = new StackPane(); stack.getChildren().addAll(new Rectangle(100,100,Color.BLUE), new Label("Go!));
StackPaneでは、管理対象の各子をそれぞれの可視プロパティの値に関係なくレイアウトします。管理対象外の子は無視されます。
StackPaneは、CSSを使用して背景およびボーダーのスタイルを指定できます。 詳細は、
Region
を参照してください。サイズ変更可能な範囲
スタック・ペインの親は、レイアウト時に、スタック・ペインのサイズ変更可能範囲内でスタック・ペインをサイズ変更します。 デフォルトでは、この範囲は、次の表に示すようにスタック・ペインのコンテンツに基づいて計算されます。
StackPaneサイズ変更表 width height 最小 左/右の枠+子の最小幅の中の最大値 上/下の枠+子の最小高の中の最大値 優先 左/右の枠+子の優先幅の中の最大値 上/下の枠+子の優先高の中の最大値 最大 Double.MAX_VALUE Double.MAX_VALUE スタック・ペインの最大幅および最大高には制限がないため、親に割り当てられているスペースすべてを満たすために、親がその優先サイズより大きいサイズに変更される可能性があります。
StackPaneには、サイズ範囲を直接設定するためのプロパティが用意されています。 これらのプロパティはデフォルトでセンチネル値USE_COMPUTED_SIZEに設定されますが、アプリケーションでは必要に応じてこれらを別の値に設定できます。
アプリケーションでは、これらのプロパティの設定をUSE_COMPUTED_SIZEに戻すことで、計算された値を復元できます。// ensure stackpane is never resized beyond it's preferred size stackpane.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
StackPaneはデフォルトではそのコンテンツをクリップしないため、子の最小サイズが原因でスタック・ペイン内に子を収めることができない場合は、子の境界がスタック・ペイン自体の境界の外側まで拡大することがあります。
オプションのレイアウト制約
アプリケーションでは、個別の子に制約を設定して、StackPaneのレイアウトをカスタマイズできます。 StackPaneでは、静的メソッドにより子に各制約を個別に設定できます。
StackPane制約表 制約 Type 説明 位置合せ javafx.geometry.Pos スタック・ペイン内での子の位置合せ。 マージン javafx.geometry.Insets 子の外側のマージン領域。 例:
// Align the title Label at the bottom-center of the stackpane Label title = new Label(); StackPane.setAlignment(title, Pos.BOTTOM_CENTER); stackpane.getChildren.addAll(new ImageView(...), title); // Create an 8 pixel margin around a listview in the stackpane ListView list = new ListView(); StackPane.setMargin(list, new Insets(8,8,8,8); stackpane.getChildren().add(list);
- 導入されたバージョン:
- JavaFX 2.0
-
-
プロパティのサマリー
プロパティ Type プロパティ 説明 ObjectProperty<Pos>
alignment
スタック・ペインの幅と高さの範囲内での子のデフォルトの位置合せ。-
クラス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
-
-
メソッドのサマリー
すべてのメソッド 静的メソッド インスタンス・メソッド 具象メソッド 修飾子と型 メソッド 説明 ObjectProperty<Pos>
alignmentProperty()
スタック・ペインの幅と高さの範囲内での子のデフォルトの位置合せ。static void
clearConstraints(Node child)
子ノードからすべてのスタック・ペイン制約を削除します。protected double
computeMinHeight(double width)
このリージョンの最小高を計算します。protected double
computeMinWidth(double height)
このリージョンの最小幅を計算します。protected double
computePrefHeight(double width)
指定された幅に対するこのリージョンの優先高を計算します。Regionのサブクラスでは、このメソッドをオーバーライドして、そのコンテンツおよびレイアウト手法に基づいて適切な値を返す必要があります。protected double
computePrefWidth(double height)
指定された高さに対するこのリージョンの優先幅を計算します。Pos
getAlignment()
プロパティalignmentの値を取得します。static Pos
getAlignment(Node child)
子の位置合せ制約を返します(設定されている場合)。static List<CssMetaData<? extends Styleable,?>>
getClassCssMetaData()
Orientation
getContentBias()
レイアウト用にノードのサイズ変更バイアスの向きを返します。List<CssMetaData<? extends Styleable,?>>
getCssMetaData()
NodeのCssMetaDataがリフレクションなしでアクセス可能になるように、このメソッドはNode.getClassCssMetaData()
に委任する必要があります。static Insets
getMargin(Node child)
子のマージン制約を返します(設定されている場合)。protected void
layoutChildren()
このParent
の子をレイアウトするレイアウト・パス中に起動されます。void
requestLayout()
次のシーンがレンダリングされる前に実行するレイアウト・パスを要求します。void
setAlignment(Pos value)
プロパティalignmentの値を設定します。static void
setAlignment(Node child, Pos value)
スタック・ペインに含まれている場合に、子の位置合せを設定します。static void
setMargin(Node child, Insets value)
スタック・ペインに含まれている場合に、子のマージンを設定します。-
クラス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, 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, getStyleClass, 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, 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, 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、lookup、needsLayoutProperty、queryAccessibleAttribute、requestParentLayout、setNeedsLayout、updateBounds
-
クラス javafx.scene.layout.Regionから継承されたメソッド
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, 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, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
-
インタフェース javafx.css.Styleableから継承されたメソッド
getStyleableNode
-
-
-
-
プロパティの詳細
-
位置合せ
public final ObjectProperty<Pos> alignmentProperty
スタック・ペインの幅と高さの範囲内での子のデフォルトの位置合せ。 子の位置合せ制約を設定することによって、個別の子でこれをオーバーライドできます。
-
-
コンストラクタの詳細
-
StackPane
public StackPane()
デフォルトのCENTER位置合せを使用して、StackPaneレイアウトを作成します。
-
StackPane
public StackPane(Node... children)
デフォルトのCENTER位置合せを使用して、StackPaneレイアウトを作成します。- パラメータ:
children
- このペインの子の初期設定。- 導入されたバージョン:
- JavaFX 8.0
-
-
メソッドの詳細
-
setAlignment
public static void setAlignment(Node child, Pos value)
スタック・ペインに含まれている場合に、子の位置合せを設定します。 設定した場合、スタック・ペインのデフォルトの位置合せがオーバーライドされます。 値をnullに設定すると、制約は削除されます。- パラメータ:
child
- スタック・ペインの子ノードvalue
- 子の配置位置
-
getAlignment
public static Pos getAlignment(Node child)
子の位置合せ制約を返します(設定されている場合)。- パラメータ:
child
- スタック・ペインの子ノード- 戻り値:
- 子の配置位置、または位置合せが設定されていない場合はnull
-
setMargin
public static void setMargin(Node child, Insets value)
スタック・ペインに含まれている場合に、子のマージンを設定します。 設定した場合、子は周囲にマージン領域を設けてレイアウトされます。 値をnullに設定すると、制約は削除されます。- パラメータ:
child
- スタック・ペインの子ノードvalue
- 子の周囲の空白のマージン
-
getMargin
public static Insets getMargin(Node child)
子のマージン制約を返します(設定されている場合)。- パラメータ:
child
- スタック・ペインの子ノード- 戻り値:
- 子のマージン、またはマージンが設定されていない場合はnull
-
clearConstraints
public static void clearConstraints(Node child)
子ノードからすべてのスタック・ペイン制約を削除します。- パラメータ:
child
- 子ノード
-
alignmentProperty
public final ObjectProperty<Pos> alignmentProperty()
スタック・ペインの幅と高さの範囲内での子のデフォルトの位置合せ。 子の位置合せ制約を設定することによって、個別の子でこれをオーバーライドできます。
-
setAlignment
public final void setAlignment(Pos value)
プロパティalignmentの値を設定します。- プロパティの説明:
- スタック・ペインの幅と高さの範囲内での子のデフォルトの位置合せ。 子の位置合せ制約を設定することによって、個別の子でこれをオーバーライドできます。
-
getAlignment
public final Pos getAlignment()
プロパティalignmentの値を取得します。- プロパティの説明:
- スタック・ペインの幅と高さの範囲内での子のデフォルトの位置合せ。 子の位置合せ制約を設定することによって、個別の子でこれをオーバーライドできます。
-
getContentBias
public Orientation getContentBias()
次のクラスからコピーされた説明:Node
レイアウト用にノードのサイズ変更バイアスの向きを返します。 ノード・タイプにはバイアスがないため、nullを返します。 ノードがサイズ変更可能で、その高さが幅に依存する場合は、HORIZONTALを返し、その幅が高さに依存する場合は、VERTICALを返します。Resizableのサブクラスはこのメソッドをオーバーライドし、適切な値を返す必要があります。
- オーバーライド:
getContentBias
、クラス:Node
- 戻り値:
- 管理対象の子の最初のnull以外のcontentBias。管理対象の子にコンテンツ・バイアスがない場合はnull。
- 関連項目:
Node.isResizable()
、Node.minWidth(double)
、Node.minHeight(double)
、Node.prefWidth(double)
、Node.prefHeight(double)
、Node.maxWidth(double)
、Node.maxHeight(double)
-
computeMinWidth
protected double computeMinWidth(double height)
クラスからコピーされた説明:Region
このリージョンの最小幅を計算します。 デフォルトでは、左枠と右枠の合計を返します。regionのサブクラスでは、このメソッドをオーバーライドして、そのコンテンツおよびレイアウト手法に基づいて適切な値を返す必要があります。 サブクラスにVERTICALコンテンツ・バイアスがない場合は、heightパラメータを無視できます。- オーバーライド:
computeMinWidth
、クラス:Region
- パラメータ:
height
- 最小幅が高さに依存する場合に使用する必要がある高さ- 戻り値:
- このリージョンの計算された最小幅
-
computeMinHeight
protected double computeMinHeight(double width)
クラスからコピーされた説明:Region
このリージョンの最小高を計算します。 デフォルトでは、上枠と下枠の合計を返します。 Regionのサブクラスでは、このメソッドをオーバーライドして、そのコンテンツおよびレイアウト手法に基づいて適切な値を返す必要があります。 サブクラスにHORIZONTALコンテンツ・バイアスがない場合は、widthパラメータを無視できます。- オーバーライド:
computeMinHeight
、クラス:Region
- パラメータ:
width
- 最小高が幅に依存する場合に使用する必要がある幅- 戻り値:
- このリージョンの計算された最小高
-
computePrefWidth
protected double computePrefWidth(double height)
クラスからコピーされた説明:Region
指定された高さに対するこのリージョンの優先幅を計算します。 Regionのサブクラスでは、このメソッドをオーバーライドして、そのコンテンツおよびレイアウト手法に基づいて適切な値を返す必要があります。 サブクラスにVERTICALコンテンツ・バイアスがない場合は、heightパラメータを無視できます。- オーバーライド:
computePrefWidth
、クラス:Region
- パラメータ:
height
- 推奨される幅がそれに依存する場合に使用する必要がある高さ- 戻り値:
- このリージョンの計算された優先幅
-
computePrefHeight
protected double computePrefHeight(double width)
クラスからコピーされた説明:Region
指定された幅に対するこのリージョンの優先高を計算します。Regionのサブクラスでは、このメソッドをオーバーライドして、そのコンテンツおよびレイアウト手法に基づいて適切な値を返す必要があります。 サブクラスにHORIZONTALコンテンツ・バイアスがない場合は、widthパラメータを無視できます。- オーバーライド:
computePrefHeight
、クラス:Region
- パラメータ:
width
- 推奨される高さがそれに依存する場合に使用する必要がある幅- 戻り値:
- このリージョンの計算された優先高
-
requestLayout
public void requestLayout()
クラスからコピーされた説明:Parent
次のシーンがレンダリングされる前に実行するレイアウト・パスを要求します。 これは、パルス(アニメーションのフレーム)ごとに1回行われるように、非同期にバッチ処理されます。この親がレイアウト・ルートまたは管理対象外のいずれかである場合は、シーンのダーティ・レイアウト・リストに直接追加されます。そうでない場合は、requestParentLayoutが起動されます。
- オーバーライド:
requestLayout
、クラス:Parent
-
layoutChildren
protected void layoutChildren()
クラスからコピーされた説明:Parent
このParent
の子をレイアウトするレイアウト・パス中に起動されます。 デフォルトでは、管理対象のサイズ変更可能なコンテンツのサイズをその優先サイズに合せて設定するのみで、ノードの配置は行われません。サブクラスは必要に応じてこの関数をオーバーライドし、コンテンツをレイアウトする必要があります。
- オーバーライド:
layoutChildren
、クラス:Parent
-
getClassCssMetaData
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
- 戻り値:
- このクラスに関連付けられたCssMetaData。スーパークラスのCssMetaDataを含むことがあります。
- 導入されたバージョン:
- JavaFX 8.0
-
getCssMetaData
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
NodeのCssMetaDataがリフレクションなしでアクセス可能になるように、このメソッドはNode.getClassCssMetaData()
に委任する必要があります。- 定義:
getCssMetaData
、インタフェース:Styleable
- オーバーライド:
getCssMetaData
、クラス:Region
- 戻り値:
- このノードに関連付けられたCssMetaData。スーパークラスのCssMetaDataを含むことがあります。
- 導入されたバージョン:
- JavaFX 8.0
-
-