public class VBox extends Pane
VBoxの例:
VBox vbox = new VBox(8); // spacing = 8
vbox.getChildren().addAll(new Button("Cut"), new Button("Copy"), new Button("Paste"));
VBoxは、子(サイズ変更可能な場合)を優先高にサイズ変更し、fillWidthプロパティを使用して、VBox自体の幅全体に表示するように子の幅をサイズ変更するか、子の幅を優先値に維持するかを決定します(fillWidthのデフォルト値はtrueです)。 コンテンツの位置合せは、alignmentプロパティ(デフォルト値はPos.TOP_LEFT)によって制御されます。
vboxが優先高よりも大きくなるようにサイズ変更された場合、子の高さはデフォルトではそれぞれの優先値に維持され、追加スペースは使用されません。 1つ以上の子に追加スペースを割り当てる必要があるアプリケーションでは、オプションで子に対してvgrow制約を設定できます。 詳細は、「オプションのレイアウト制約」を参照してください。
VBoxでは、管理対象の各子をそれぞれの可視プロパティの値に関係なくレイアウトします。管理対象外の子は無視されます。
| width | height | |
|---|---|---|
| 最小 | 左/右の枠+子の最小幅の中の最大値 | 上/下の枠+各子の最小高の合計+各子間のスペース |
| 優先 | 左/右の枠+子の優先幅の中の最大値 | 上/下の枠+各子の優先高の合計+各子間のスペース |
| 最大 | Double.MAX_VALUE | Double.MAX_VALUE |
vboxの最大幅および最大高には制限がないため、親に割り当てられているスペースすべてを満たすために、親がその優先サイズより大きいサイズに変更される可能性があります。
VBoxには、サイズ範囲を直接設定するためのプロパティが用意されています。 これらのプロパティはデフォルトでセンチネル値USE_COMPUTED_SIZEに設定されますが、アプリケーションでは必要に応じてこれらを別の値に設定できます。
vbox.setPrefWidth(400);
アプリケーションでは、これらのプロパティの設定をUSE_COMPUTED_SIZEに戻すことで、計算された値を復元できます。
VBoxはデフォルトではそのコンテンツをクリップしないため、子の最小サイズが原因でvbox内に子を収めることができない場合は、子の境界がvbox自体の境界の外側まで拡大することがあります。
| 制約 | Type | 説明 |
|---|---|---|
| vgrow | javafx.scene.layout.Priority | 子の垂直方向の拡大優先度。 |
| マージン | javafx.geometry.Insets | 子の外側のマージン領域。 |
たとえば、vboxでListViewに追加スペースをすべて割り当てる必要がある場合は、次のようにします。
VBox vbox = new VBox();
ListView list = new ListView();
VBox.setVgrow(list, Priority.ALWAYS);
vbox.getChildren().addAll(new Label("Names:"), list);
複数の子に同じ拡大優先度が設定されている場合は、各子にスペースが均等に割り当てられます。 VBoxはその最大高を上限として子を拡大するため、子にDouble.MAX_VALUE以外の最大高が設定されているときには、アプリケーションでその値をオーバーライドして子を拡大できるようにする必要がある場合があります。 | Type | プロパティと説明 |
|---|---|
ObjectProperty<Pos> |
alignment
vboxの幅と高さの範囲内での子の全体的な位置合せ。
|
BooleanProperty |
fillWidth
サイズ変更可能な子のサイズを変更してvboxの幅全体に表示するか、それとも、好みの幅を維持して、
alignment hpos値に従って位置合せするか。 |
DoubleProperty |
spacing
vboxの子の間の垂直方向の総スペース。
|
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| コンストラクタと説明 |
|---|
VBox()
スペースを0、位置合せをTOP_LEFTとしてVBoxレイアウトを作成します。
|
VBox(double spacing)
子間のスペースを指定してVBoxレイアウトを作成します。
|
VBox(double spacing, Node... children)
子間のスペーシングを指定したVBoxレイアウトを作成します。
|
VBox(Node... children)
スペーシングが0のVBoxレイアウトを作成します。
|
| 修飾子と型 | メソッドと説明 |
|---|---|
ObjectProperty<Pos> |
alignmentProperty()
vboxの幅と高さの範囲内での子の全体的な位置合せ。
|
static void |
clearConstraints(Node child)
子ノードからすべてのvbox制約を削除します。
|
protected double |
computeMinHeight(double width)
このリージョンの最小高を計算します。
|
protected double |
computeMinWidth(double height)
このリージョンの最小幅を計算します。
|
protected double |
computePrefHeight(double width)
指定された幅に対するこのリージョンの優先高を計算します。Regionのサブクラスでは、このメソッドをオーバーライドして、そのコンテンツおよびレイアウト手法に基づいて適切な値を返す必要があります。
|
protected double |
computePrefWidth(double height)
指定された高さに対するこのリージョンの優先幅を計算します。
|
BooleanProperty |
fillWidthProperty()
サイズ変更可能な子のサイズを変更してvboxの幅全体に表示するか、それとも、好みの幅を維持して、
alignment hpos値に従って位置合せするか。 |
Pos |
getAlignment()
プロパティalignmentの値を取得します。
|
static List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
Orientation |
getContentBias()
レイアウト用にノードのサイズ変更バイアスの向きを返します。
|
List<CssMetaData<? extends Styleable,?>> |
getCssMetaData()
NodeのCssMetaDataがリフレクションなしでアクセス可能になるように、このメソッドは
Node.getClassCssMetaData()に委任する必要があります。 |
static Insets |
getMargin(Node child)
子のマージン・プロパティを返します(設定されている場合)。
|
double |
getSpacing()
プロパティspacingの値を取得します。
|
static Priority |
getVgrow(Node child)
子のvgrowプロパティを返します(設定されている場合)。
|
boolean |
isFillWidth()
プロパティfillWidthの値を取得します。
|
protected void |
layoutChildren()
この
Parentの子をレイアウトするレイアウト・パス中に起動されます。 |
void |
requestLayout()
次のシーンがレンダリングされる前に実行するレイアウト・パスを要求します。
|
void |
setAlignment(Pos value)
プロパティalignmentの値を設定します。
|
void |
setFillWidth(boolean value)
プロパティfillWidthの値を設定します。
|
static void |
setMargin(Node child, Insets value)
vboxに含まれている場合に、子のマージンを設定します。
|
void |
setSpacing(double value)
プロパティspacingの値を設定します。
|
static void |
setVgrow(Node child, Priority value)
vboxに含まれている場合に、子の垂直方向の拡大優先度を設定します。
|
DoubleProperty |
spacingProperty()
vboxの子の間の垂直方向の総スペース。
|
getChildrenbackgroundProperty, 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, snapSize, snapSpace, snapToPixelProperty, widthPropertygetBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, 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, 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 final DoubleProperty spacingProperty
public final ObjectProperty<Pos> alignmentProperty
public final BooleanProperty fillWidthProperty
alignment hpos値に従って位置合せするか。public VBox()
public VBox(double spacing)
spacing - 各子間の垂直方向のスペースの量。public VBox(Node... children)
children - このペインの子の初期設定。public VBox(double spacing,
Node... children)
spacing - 各子間の水平方向のスペースの量。children - このペインの子の初期設定。public static void setVgrow(Node child, Priority value)
child - vboxの子value - 子の水平方向の拡大優先度public static Priority getVgrow(Node child)
child - vboxの子ノードpublic static void setMargin(Node child, Insets value)
child - vboxの子ノードvalue - 子の周囲の空白のマージンpublic static Insets getMargin(Node child)
child - vboxの子ノードpublic static void clearConstraints(Node child)
child - 子ノードpublic final DoubleProperty spacingProperty()
public final void setSpacing(double value)
public final double getSpacing()
public final ObjectProperty<Pos> alignmentProperty()
public final void setAlignment(Pos value)
public final Pos getAlignment()
public final BooleanProperty fillWidthProperty()
alignment hpos値に従って位置合せするか。public final void setFillWidth(boolean value)
alignment hpos値に従って位置合せするか。public final boolean isFillWidth()
alignment hpos値に従って位置合せするか。public Orientation getContentBias()
NodeResizableのサブクラスはこのメソッドをオーバーライドし、適切な値を返す必要があります。
getContentBias、クラスNodeNode.isResizable()、Node.minWidth(double)、Node.minHeight(double)、Node.prefWidth(double)、Node.prefHeight(double)、Node.maxWidth(double)、Node.maxHeight(double)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 - 推奨される高さがそれに依存する場合に使用する必要がある幅public void requestLayout()
Parentこの親がレイアウト・ルートまたは管理対象外のいずれかである場合は、シーンのダーティ・レイアウト・リストに直接追加されます。そうでない場合は、requestParentLayoutが起動されます。
requestLayout、クラスParentprotected void layoutChildren()
ParentParentの子をレイアウトするレイアウト・パス中に起動されます。 デフォルトでは、管理対象のサイズ変更可能なコンテンツのサイズをその優先サイズに合せて設定するのみで、ノードの配置は行われません。
サブクラスは必要に応じてこの関数をオーバーライドし、コンテンツをレイアウトする必要があります。
layoutChildren、クラスParentpublic static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
Node.getClassCssMetaData()に委任する必要があります。getCssMetaData、インタフェースStyleablegetCssMetaData、クラスRegionCopyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.