- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.layout.Pane
-
- javafx.scene.layout.AnchorPane
-
- すべての実装されたインタフェース:
Styleable
,EventTarget
public class AnchorPane extends Pane
AnchorPaneは、子ノードの枠をアンカー・ペインの枠からのオフセット位置までアンカーします。 アンカー・ペインにボーダーまたは余白(あるいはその両方)が設定されている場合、オフセットはこれらの枠の内側の端から測定されます。AnchorPaneでは、子の可視プロパティ値に関係なく各管理対象の子がレイアウトされ、管理対象外の子はすべてのレイアウト計算で無視されます。
CSSを使用して、背景およびボーダーがあるAnchorPaneのスタイルを設定できます。 詳細は、
Region
スーパー・クラスを参照してください。アンカー制約
アプリケーションでは、1つ以上の側にアンカーを構成するために、各子にアンカー制約を設定します。 子が反対側にアンカーされる場合(かつ、子がサイズ変更可能な場合)は、アンカー・ペインは子をサイズ変更して両方のオフセットを保持しますが、それ以外の場合は、アンカー・ペインは子を優先サイズに合せてサイズ変更します。 前者の(反対側にアンカーされる)ケースで、子のサイズ変更ができない場合は、上/左のアンカーのみが考慮されます。 AnchorPaneでは、各アンカー制約を設定する静的メソッドを提供します。
AnchorPane制約表 制約 Type 説明 topAnchor double アンカー・ペインの上枠から子の上端までの距離。 leftAnchor double アンカー・ペインの左枠から子の左端までの距離。 bottomAnchor double アンカー・ペインの下枠から子の下端までの距離。 rightAnchor double アンカー・ペインの右枠から子の右端までの距離。 AnchorPaneの例:
AnchorPane anchorPane = new AnchorPane(); // List should stretch as anchorPane is resized ListView list = new ListView(); AnchorPane.setTopAnchor(list, 10.0); AnchorPane.setLeftAnchor(list, 10.0); AnchorPane.setRightAnchor(list, 65.0); // Button will float on right edge Button button = new Button("Add"); AnchorPane.setTopAnchor(button, 10.0); AnchorPane.setRightAnchor(button, 10.0); anchorPane.getChildren().addAll(list, button);
サイズ変更可能な範囲
アンカー・ペインの親は、レイアウト中にアンカー・ペインのサイズ変更可能な範囲内でアンカー・ペインをサイズ変更します。 デフォルトでは、アンカー・ペインは、次の表で説明するように、そのコンテンツに基づいてこの範囲を計算します。
AnchorPaneサイズ変更表 width height 最小 左/右の枠+左/右にアンカーされる子が少なくともその最小幅を使用して表示されるために必要な幅 上/下の枠+上/下にアンカーされる子が少なくともその最小高を使用して表示されるために必要な高さ 優先 左/右の枠+左/右にアンカーされる子が少なくともその優先幅を使用して表示されるために必要な幅 上/下の枠+上/下にアンカーされる子が少なくともその優先高を使用して表示されるために必要な高さ 最大 Double.MAX_VALUE Double.MAX_VALUE アンカー・ペインの最大幅および最大高には制限がないため、親に割り当てられているスペースすべてを満たすために、親がその優先サイズより大きいサイズに変更される可能性があります。
AnchorPaneでは、直接サイズ範囲を設定するプロパティを提供します。 これらのプロパティのデフォルトはセンチネル値Region.USE_COMPUTED_SIZEになりますが、アプリケーションで、必要に応じて、次のような他の値に設定できます。
アプリケーションでは、これらのプロパティをRegion.USE_COMPUTED_SIZEに戻すことによって、計算値をリストアできます。anchorPane.setPrefSize(300, 300);
AnchorPaneはデフォルトではそのコンテンツをクリップしないため、アンカー・ペインがその優先サイズより小さいサイズに変更されると、子の境界がAnchorPane自体の境界の外側まで拡大することがあります。
- 導入されたバージョン:
- JavaFX 2.0
-
-
プロパティのサマリー
-
クラス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
-
-
コンストラクタのサマリー
コンストラクタ コンストラクタ 説明 AnchorPane()
AnchorPaneレイアウトを作成します。AnchorPane(Node... children)
子が指定されたAnchorPaneレイアウトを作成します。
-
メソッドのサマリー
すべてのメソッド 静的メソッド インスタンス・メソッド 具象メソッド 修飾子と型 メソッド 説明 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)
指定された高さに対するこのリージョンの優先幅を計算します。static Double
getBottomAnchor(Node child)
設定されている場合は子の下アンカー制約を返します。static Double
getLeftAnchor(Node child)
設定されている場合は子の左アンカー制約を返します。static Double
getRightAnchor(Node child)
設定されている場合は子の右アンカー制約を返します。static Double
getTopAnchor(Node child)
設定されている場合は子の上アンカー制約を返します。protected void
layoutChildren()
このParent
の子をレイアウトするレイアウト・パス中に起動されます。static void
setBottomAnchor(Node child, Double value)
アンカー・ペインに含まれている場合に、子の下アンカーを設定します。static void
setLeftAnchor(Node child, Double value)
アンカー・ペインに含まれている場合に、子の左アンカーを設定します。static void
setRightAnchor(Node child, Double value)
アンカー・ペインに含まれている場合に、子の右アンカーを設定します。static void
setTopAnchor(Node child, Double 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, 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, 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、requestLayout、requestParentLayout、setNeedsLayout、updateBounds
-
クラス javafx.scene.layout.Regionから継承されたメソッド
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, getBackground, getBorder, getClassCssMetaData, 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
-
-
-
-
コンストラクタの詳細
-
AnchorPane
public AnchorPane()
AnchorPaneレイアウトを作成します。
-
AnchorPane
public AnchorPane(Node... children)
子が指定されたAnchorPaneレイアウトを作成します。- パラメータ:
children
- このペインの子の初期設定。- 導入されたバージョン:
- JavaFX 8.0
-
-
メソッドの詳細
-
setTopAnchor
public static void setTopAnchor(Node child, Double value)
アンカー・ペインに含まれている場合に、子の上アンカーを設定します。 設定されている場合、アンカー・ペインは子のサイズおよび位置を保持するため、その上部は常にアンカー・ペインのコンテンツ上端からその量でオフセットされます。 値をnullに設定すると、制約は削除されます。- パラメータ:
child
- アンカー・ペインの子ノードvalue
- アンカー・ペインの上部からのオフセット
-
getTopAnchor
public static Double getTopAnchor(Node child)
設定されている場合は子の上アンカー制約を返します。- パラメータ:
child
- アンカー・ペインの子ノード- 戻り値:
- アンカー・ペインの上部からのオフセット、または上アンカーが設定されていない場合はnull
-
setLeftAnchor
public static void setLeftAnchor(Node child, Double value)
アンカー・ペインに含まれている場合に、子の左アンカーを設定します。 設定されている場合、アンカー・ペインは子のサイズおよび位置を保持するため、その左側は常にアンカー・ペインのコンテンツ左端からその量でオフセットされます。 値をnullに設定すると、制約は削除されます。- パラメータ:
child
- アンカー・ペインの子ノードvalue
- アンカー・ペインの左側からのオフセット
-
getLeftAnchor
public static Double getLeftAnchor(Node child)
設定されている場合は子の左アンカー制約を返します。- パラメータ:
child
- アンカー・ペインの子ノード- 戻り値:
- アンカー・ペインの左側からのオフセット、または左アンカーが設定されていない場合はnull
-
setBottomAnchor
public static void setBottomAnchor(Node child, Double value)
アンカー・ペインに含まれている場合に、子の下アンカーを設定します。 設定されている場合、アンカー・ペインは子のサイズおよび位置を保持するため、その下部は常にアンカー・ペインのコンテンツ下端からその量でオフセットされます。 値をnullに設定すると、制約は削除されます。- パラメータ:
child
- アンカー・ペインの子ノードvalue
- アンカー・ペインの下部からのオフセット
-
getBottomAnchor
public static Double getBottomAnchor(Node child)
設定されている場合は子の下アンカー制約を返します。- パラメータ:
child
- アンカー・ペインの子ノード- 戻り値:
- アンカー・ペインの下部からのオフセット、または下アンカーが設定されていない場合はnull
-
setRightAnchor
public static void setRightAnchor(Node child, Double value)
アンカー・ペインに含まれている場合に、子の右アンカーを設定します。 設定されている場合、アンカー・ペインは子のサイズおよび位置を保持するため、その右側は常にアンカー・ペインのコンテンツ右端からその量でオフセットされます。 値をnullに設定すると、制約は削除されます。- パラメータ:
child
- アンカー・ペインの子ノードvalue
- アンカー・ペインの右側からのオフセット
-
getRightAnchor
public static Double getRightAnchor(Node child)
設定されている場合は子の右アンカー制約を返します。- パラメータ:
child
- アンカー・ペインの子ノード- 戻り値:
- アンカー・ペインの右側からのオフセット、または右アンカーが設定されていない場合はnull
-
clearConstraints
public static void clearConstraints(Node child)
子ノードからアンカー・ペイン制約をすべて削除します。- パラメータ:
child
- 子ノード
-
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
- 推奨される高さがそれに依存する場合に使用する必要がある幅- 戻り値:
- このリージョンの計算された優先高
-
layoutChildren
protected void layoutChildren()
クラスからコピーされた説明:Parent
このParent
の子をレイアウトするレイアウト・パス中に起動されます。 デフォルトでは、管理対象のサイズ変更可能なコンテンツのサイズをその優先サイズに合せて設定するのみで、ノードの配置は行われません。サブクラスは必要に応じてこの関数をオーバーライドし、コンテンツをレイアウトする必要があります。
- オーバーライド:
layoutChildren
、クラス:Parent
-
-