public class AnchorPane extends Pane
AnchorPaneでは、子の可視プロパティ値に関係なく各管理対象の子がレイアウトされ、管理対象外の子はすべてのレイアウト計算で無視されます。
CSSを使用して、背景およびボーダーがあるAnchorPaneのスタイルを設定できます。 詳細は、Regionスーパー・クラスを参照してください。
| 制約 | 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);
| width | height | |
|---|---|---|
| 最小 | 左/右の枠+左/右にアンカーされる子が少なくともその最小幅を使用して表示されるために必要な幅 | 上/下の枠+上/下にアンカーされる子が少なくともその最小高を使用して表示されるために必要な高さ |
| 優先 | 左/右の枠+左/右にアンカーされる子が少なくともその優先幅を使用して表示されるために必要な幅 | 上/下の枠+上/下にアンカーされる子が少なくともその優先高を使用して表示されるために必要な高さ |
| 最大 | Double.MAX_VALUE | Double.MAX_VALUE |
アンカー・ペインの最大幅および最大高には制限がないため、親に割り当てられているスペースすべてを満たすために、親がその優先サイズより大きいサイズに変更される可能性があります。
AnchorPaneでは、直接サイズ範囲を設定するプロパティを提供します。 これらのプロパティのデフォルトはセンチネル値Region.USE_COMPUTED_SIZEになりますが、アプリケーションで、必要に応じて、次のような他の値に設定できます。
anchorPane.setPrefSize(300, 300);
アプリケーションでは、これらのプロパティをRegion.USE_COMPUTED_SIZEに戻すことによって、計算値をリストアできます。
AnchorPaneはデフォルトではそのコンテンツをクリップしないため、アンカー・ペインがその優先サイズより小さいサイズに変更されると、子の境界がAnchorPane自体の境界の外側まで拡大することがあります。
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthneedsLayoutaccessibleHelp, 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, visibleUSE_COMPUTED_SIZE, USE_PREF_SIZEBASELINE_OFFSET_SAME_AS_HEIGHT| コンストラクタと説明 |
|---|
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)
アンカー・ペインに含まれている場合に、子の上アンカーを設定します。
|
getChildrenbackgroundProperty, 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, snapSize, snapSpace, snapToPixelProperty, widthPropertygetBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsaccessibleHelpProperty, 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, 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, usesMirroring, visiblePropertypublic AnchorPane()
public AnchorPane(Node... children)
children - このペインの子の初期設定。public static void setTopAnchor(Node child, Double value)
child - アンカー・ペインの子ノードvalue - アンカー・ペインの上部からのオフセットpublic static Double getTopAnchor(Node child)
child - アンカー・ペインの子ノードpublic static void setLeftAnchor(Node child, Double value)
child - アンカー・ペインの子ノードvalue - アンカー・ペインの左側からのオフセットpublic static Double getLeftAnchor(Node child)
child - アンカー・ペインの子ノードpublic static void setBottomAnchor(Node child, Double value)
child - アンカー・ペインの子ノードvalue - アンカー・ペインの下部からのオフセットpublic static Double getBottomAnchor(Node child)
child - アンカー・ペインの子ノードpublic static void setRightAnchor(Node child, Double value)
child - アンカー・ペインの子ノードvalue - アンカー・ペインの右側からのオフセットpublic static Double getRightAnchor(Node child)
child - アンカー・ペインの子ノードpublic static void clearConstraints(Node child)
child - 子ノードprotected double computeMinWidth(double height)
RegioncomputeMinWidth、クラスRegionheight - 最小幅が高さに依存する場合に使用する必要がある高さprotected double computeMinHeight(double width)
RegioncomputeMinHeight、クラスRegionwidth - 最小高が幅に依存する場合に使用する必要がある幅protected double computePrefWidth(double height)
RegioncomputePrefWidth、クラスRegionheight - 推奨される幅がそれに依存する場合に使用する必要がある高さprotected double computePrefHeight(double width)
RegioncomputePrefHeight、クラスRegionwidth - 推奨される高さがそれに依存する場合に使用する必要がある幅protected void layoutChildren()
ParentParentの子をレイアウトするレイアウト・パス中に起動されます。 デフォルトでは、管理対象のサイズ変更可能なコンテンツのサイズをその優先サイズに合せて設定するのみで、ノードの配置は行われません。
サブクラスは必要に応じてこの関数をオーバーライドし、コンテンツをレイアウトする必要があります。
layoutChildren、クラスParentCopyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.