public class ButtonBar extends Control
HBoxにオペレーティング・システム固有のボタン配置のための機能を追加したものです。 つまり、いずれのNodeも、setButtonData(Node, ButtonData)メソッドを介して注釈を付け、(getButtons()リストを介して) ButtonBar内部に配置し、その注釈に基づいてボタン・リスト内の他のすべてのノードおよびButtonBarに指定された包括的なbutton orderを基準として配置することができます。 均一ボタン・サイジング
デフォルトでは、ButtonBar内のすべてのボタンは均一のサイズに設定され、つまりすべてのボタンに最も幅の広いボタンの幅が適用されます。 setButtonUniformSize(Node, boolean)メソッドをブール値falseで呼び出して、ボタンごとにこれを取り消すことが可能です。
均一サイジングから除外されたボタンは、優先サイズが取り消されて再設定されることも、測定プロセスに含まれることもないため、そのボタンのサイズがButtonBar内のすべてのボタンに対して計算される最大サイズに影響を与えることはありません。
ButtonBarにはWindows、Mac OSおよびLinuxの組込みサポートが付属しているため、3つのスクリーンショットを次に示します。3つのオペレーティング・システムそれぞれに同じボタンが配置されています。
Windows:
Mac OS:
Linux:
ButtonBarをインスタンス化および使用するのは簡単で、次のように記述するだけです。
// Create the ButtonBar instance
ButtonBar buttonBar = new ButtonBar();
// Create the buttons to go into the ButtonBar
Button yesButton = new Button("Yes");
ButtonBar.setButtonData(yesButton, ButtonData.YES);
Button noButton = new Button("No");
ButtonBar.setButtonData(noButton, ButtonData.NO);
// Add buttons to the ButtonBar
buttonBar.getButtons().addAll(yesButton, noButton);
前述のコード・サンプルでは、ユーザーのオペレーティング・システムを基準にしてYesボタンとNoボタンが配置されます。 つまり、WindowsおよびLinuxではYesボタンがNoボタンの前に配置され、Mac OSではNoの次にYesが配置されます。
ほとんどの場合、OSに固有のレイアウトが最適なレイアウトですが、button order propertyを変更してカスタム・レイアウトにすることもできます。 これらは、ボタン順序の短縮表記である暗号的な文字列です。 Windows、Mac OSおよびLinuxでの組込み順序は次のとおりです。
| Windows: | L_E+U+FBXI_YNOCAH_R |
| Mac OS: | L_HE+U+FBIX_NCYOA_R |
| Linux: | L_HE+UNYACBXIO_R |
これらの各文字の意味の説明は、ButtonBar.ButtonData列挙を参照してください。 ただし、ButtonBarにButtonBar.ButtonData.YESボタンとButtonBar.ButtonData.NOボタンのみを含め、yesボタンを常にnoボタンの前に配置し、かつボタンを右揃えにすた場合は、次のようにします。
// Create the ButtonBar instance
ButtonBar buttonBar = new ButtonBar();
// Set the custom button order
buttonBar.setButtonOrder("+YN");
ButtonBar.ButtonData| Type | プロパティと説明 |
|---|---|
DoubleProperty |
buttonMinWidth
このボタン・バーに配置するすべてのボタンの最小幅を指定します。
|
StringProperty |
buttonOrder
標準のボタン・バー内の一般的なボタンの順序。
|
contextMenu, skin, tooltipbackground, 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, visible| 修飾子と型 | クラスと説明 |
|---|---|
static class |
ButtonBar.ButtonData
すべての使用可能なボタン・データ注釈の列挙。
|
| 修飾子と型 | フィールドと説明 |
|---|---|
static String |
BUTTON_ORDER_LINUX
Linux (特にGNOME)でのデフォルトのボタン並び順。
|
static String |
BUTTON_ORDER_MAC_OS
Mac OSでのデフォルトのボタン並び順。
|
static String |
BUTTON_ORDER_NONE
ボタン並び順がないことを指定するボタン並び順文字列。
|
static String |
BUTTON_ORDER_WINDOWS
Windowsでのデフォルトのボタン並び順。
|
USE_COMPUTED_SIZE, USE_PREF_SIZEBASELINE_OFFSET_SAME_AS_HEIGHT| コンストラクタと説明 |
|---|
ButtonBar()
ユーザーのオペレーティング・システムのデフォルト・プロパティを使用して、デフォルトのButtonBarインスタンスを作成します。
|
ButtonBar(String buttonOrder)
指定されたボタン順序でButtonBarを作成します(詳細は
「buttonOrderProperty()」を参照)。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
DoubleProperty |
buttonMinWidthProperty()
このボタン・バーに配置するすべてのボタンの最小幅を指定します。
|
StringProperty |
buttonOrderProperty()
標準のボタン・バー内の一般的なボタンの順序。
|
protected Skin<?> |
createDefaultSkin()
このコントロールのデフォルト・スキンの新しいインスタンスを作成します。
|
static ButtonBar.ButtonData |
getButtonData(Node button)
指定されたボタンに以前に設定されたButtonDataプロパティを返します。
|
double |
getButtonMinWidth()
このボタン・バーに配置するすべてのボタンの最小幅を返します。
|
String |
getButtonOrder()
現在の
button orderを返します。 |
ObservableList<Node> |
getButtons()
このObservableList内にボタンを配置すると、指定した
ButtonBar.ButtonDataに基づいてボタンそれぞれを相対的に配置するようButtonBarに指示します。 |
static boolean |
isButtonUniformSize(Node button)
指定されたノードが均一サイジング計算に含まれるかどうかを返します。
|
static void |
setButtonData(Node button, ButtonBar.ButtonData buttonData)
指定されたボタンに、指定されたButtonDataを設定します。
|
void |
setButtonMinWidth(double value)
このボタン・バーに配置するすべてのボタンの最小幅を設定します。
|
void |
setButtonOrder(String buttonOrder)
button orderを設定します |
static void |
setButtonUniformSize(Node button, boolean uniformSize)
デフォルトでは、ButtonBar内のすべてのボタンは均一のサイズに設定され、つまりすべてのボタンに最も幅の広いボタンの幅が適用されます。
|
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipPropertybackgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, 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, widthPropertygetChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, 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, 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 final StringProperty buttonOrderProperty
ButtonBar.ButtonData列挙値ごとに1文字です。 オペレーティング・システムのデフォルトのボタン順序(BUTTON_ORDER_WINDOWS、BUTTON_ORDER_MAC_OSおよびBUTTON_ORDER_LINUX)も使用可能です。 public final DoubleProperty buttonMinWidthProperty
public static final String BUTTON_ORDER_WINDOWS
public static final String BUTTON_ORDER_MAC_OS
public static final String BUTTON_ORDER_LINUX
public static final String BUTTON_ORDER_NONE
getButtons()リスト内の順序で配置されます。 レイアウトでHBoxを使用する場合と異なる点は、ボタンが右揃えであることのみです。 public ButtonBar()
public ButtonBar(String buttonOrder)
「buttonOrderProperty()」を参照)。buttonOrder - このボタン・バー・インスタンスで使用するボタン順序。public static void setButtonData(Node button, ButtonBar.ButtonData buttonData)
ButtonBarに配置されるとき、バーの他のすべてのボタンを基準にして正しい位置に配置されます。 button - 指定されたButtonBar.ButtonData値で注釈付けするボタン。buttonData - ボタンの指定に使用するButtonData。public static ButtonBar.ButtonData getButtonData(Node button)
button - 以前に設定されたButtonDataを返すボタン。public static void setButtonUniformSize(Node button, boolean uniformSize)
均一サイジングから除外されたボタンは、優先サイズが取り消されて再設定されることも、測定プロセスに含まれることもないため、そのボタンのサイズがButtonBar内のすべてのボタンに対して計算される最大サイズに影響を与えることはありません。
button - 均一サイジングに含める、または均一サイジングから除外するボタン。uniformSize - ボタンに均一サイジングを適用する場合はブールのtrue、ボタンを均一サイジングから除外する場合はfalse。public static boolean isButtonUniformSize(Node button)
setButtonUniformSize(Node, boolean)を介して)除外されていないノードはすべてここでtrueを返します。 protected Skin<?> createDefaultSkin()
-fx-skinを介してスキンが提供されていない場合にコントロール用のスキンを作成するために、またはsetSkin(...)を使用してサブクラスで明示的に設定するために呼び出されます。 createDefaultSkin、クラスControlpublic final ObservableList<Node> getButtons()
ButtonBar.ButtonDataに基づいてボタンそれぞれを相対的に配置するようButtonBarに指示します。 ボタンのButtonDataを設定するには、setButtonData(Node, ButtonData)を呼び出して、関連するButtonDataを渡すだけです。 public final StringProperty buttonOrderProperty()
ButtonBar.ButtonData列挙値ごとに1文字です。 オペレーティング・システムのデフォルトのボタン順序(BUTTON_ORDER_WINDOWS、BUTTON_ORDER_MAC_OSおよびBUTTON_ORDER_LINUX)も使用可能です。 public final void setButtonOrder(String buttonOrder)
button orderを設定しますbuttonOrder - 現在設定されているボタン順序(デフォルトではOSに固有のボタン順序になります)。public final String getButtonOrder()
button orderを返します。ボタン順序。public final DoubleProperty buttonMinWidthProperty()
public final void setButtonMinWidth(double value)
public final double getButtonMinWidth()
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.