public class MenuButton extends ButtonBase
ContextMenu
が表示されるボタンです。表示されるアイテムをitems
ObservableListに設定し、かつMenuButton内に表示されるラベルを指定するためのLabeled.text
プロパティがある場合、MenuButtonはMenu
コントロールに非常によく似たAPIを共有します。
前述のとおり、Menu API自体と同様に、items
ObservableListでは、MenuItem
から拡張したアイテムを提供できます。MenuItem
の有用なサブクラスには、RadioMenuItem
、CheckMenuItem
、Menu
、SeparatorMenuItem
、CustomMenuItem
などがあります。
MenuButtonは、ボタンの任意の側にメニューを表示するように設定できます。これを指定するには、popupSide
プロパティを使用します。デフォルトでは、メニューはボタンの下に表示されます。ただし、popupSideの指定に関係なく、十分な領域がない場合には、ContextMenu
は適宜(通常はMenuButtonの反対側に)配置されます。
例:
MenuButton m = new MenuButton("Eats"); m.getItems().addAll(new MenuItem("Burger"), new MenuItem("Hot Dog"));
MnemonicParsingは、MenuButtonではデフォルトで有効になっています。
MenuItem
、Menu
、SplitMenuButton
Type | プロパティと説明 |
---|---|
ObjectProperty<Side> |
popupSide
MenuButtonについて、どちら側で
ContextMenu を開くかを示します。 |
ReadOnlyBooleanProperty |
showing
ContextMenu が現在表示されているかどうかを示します。 |
armed、onAction
alignment、contentDisplay、ellipsisString、font、graphic、graphicTextGap、labelPadding、lineSpacing、mnemonicParsing、textAlignment、textFill、textOverrun、text、underline、wrapText
contextMenu、skin、tooltip
background、border、cacheShape、centerShape、height、insets、maxHeight、maxWidth、minHeight、minWidth、opaqueInsets、padding、prefHeight、prefWidth、scaleShape、shape、snapToPixel、width
needsLayout
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、visible
USE_COMPUTED_SIZE、USE_PREF_SIZE
BASELINE_OFFSET_SAME_AS_HEIGHT
コンストラクタと説明 |
---|
MenuButton()
新しい空のメニュー・ボタンを作成します。
|
MenuButton(String text)
新しい空のメニュー・ボタンを作成し、指定されたテキストがボタンに表示されるようにします。
|
MenuButton(String text, Node graphic)
新しい空のメニュー・ボタンを作成し、指定されたテキストとグラフィックがボタンに表示されるようにします。
|
MenuButton(String text, Node graphic, MenuItem... items)
新しい空のメニュー・ボタンを作成して、指定されたテキストとグラフィックがボタンに表示されるようにし、指定されたアイテムを
items リストに挿入します。 |
修飾子と型 | メソッドと説明 |
---|---|
protected Skin<?> |
createDefaultSkin()
このコントロールのデフォルト・スキンの新しいインスタンスを作成します。
|
void |
executeAccessibleAction(AccessibleAction action, Object... parameters)
*アクセシビリティ処理* *
|
void |
fire()
これは何も行いません。
|
ObservableList<MenuItem> |
getItems()
このボタン・メニュー内に表示するアイテム。
|
Side |
getPopupSide()
プロパティpopupSideの値を取得します。
|
void |
hide()
ContextMenu を非表示にします。 |
boolean |
isShowing()
プロパティshowingの値を取得します。
|
ObjectProperty<Side> |
popupSideProperty()
MenuButtonについて、どちら側で
ContextMenu を開くかを示します。 |
void |
setPopupSide(Side value)
プロパティpopupSideの値を設定します。
|
void |
show()
このMenuButtonは無効ではないという前提で、
ContextMenu を表示します。 |
ReadOnlyBooleanProperty |
showingProperty()
ContextMenu が現在表示されているかどうかを示します。 |
arm、armedProperty、disarm、getOnAction、isArmed、onActionProperty、setOnAction
alignmentProperty、contentDisplayProperty、ellipsisStringProperty、fontProperty、getAlignment、getClassCssMetaData、getContentBias、getContentDisplay、getControlCssMetaData、getEllipsisString、getFont、getGraphic、getGraphicTextGap、getLabelPadding、getLineSpacing、getText、getTextAlignment、getTextFill、getTextOverrun、graphicProperty、graphicTextGapProperty、isMnemonicParsing、isUnderline、isWrapText、labelPaddingProperty、lineSpacingProperty、mnemonicParsingProperty、setAlignment、setContentDisplay、setEllipsisString、setFont、setGraphic、setGraphicTextGap、setLineSpacing、setMnemonicParsing、setText、setTextAlignment、setTextFill、setTextOverrun、setUnderline、setWrapText、textAlignmentProperty、textFillProperty、textOverrunProperty、textProperty、toString、underlineProperty、wrapTextProperty
computeMaxHeight、computeMaxWidth、computeMinHeight、computeMinWidth、computePrefHeight、computePrefWidth、contextMenuProperty、getBaselineOffset、getContextMenu、getCssMetaData、getSkin、getTooltip、isResizable、layoutChildren、queryAccessibleAttribute、setContextMenu、setSkin、setTooltip、skinProperty、tooltipProperty
backgroundProperty、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、widthProperty
getChildren、getChildrenUnmodifiable、getManagedChildren、getStylesheets、isNeedsLayout、layout、lookup、needsLayoutProperty、requestLayout、requestParentLayout、setNeedsLayout、updateBounds
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、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、translateXProperty、translateYProperty、translateZProperty、usesMirroring、visibleProperty
public final ReadOnlyBooleanProperty showingProperty
ContextMenu
が現在表示されているかどうかを示します。isShowing()
public final ObjectProperty<Side> popupSideProperty
ContextMenu
を開くかを示します。メニュー・アイテムは、通常、いずれの場合も垂直にレイアウトされます。たとえば、メニュー・ボタンがアプリケーションの左端の垂直ツールバーにある場合、popupSide
をSide.RIGHT
に変更すると、MenuButtonの右側にポップアップが表示されるようになります。Side.BOTTOM
getPopupSide()
、setPopupSide(Side)
public MenuButton()
Labeled.setText(String)
、Labeled.setGraphic(Node)
およびgetItems()
を使用して、そのコンテンツを設定します。public MenuButton(String text)
Labeled.setGraphic(Node)
およびgetItems()
を使用して、そのコンテンツを設定します。text
- メニュー・ボタンに表示するテキストpublic MenuButton(String text, Node graphic)
getItems()
を使用して、そのコンテンツを設定します。text
- メニュー・ボタンに表示するテキストgraphic
- メニュー・ボタンに表示するグラフィックpublic final ObservableList<MenuItem> getItems()
よく使用されるコントロールには、MenuItem
、CheckMenuItem
、RadioMenuItem
などに加えて、メニューに追加するとサブメニューになる、Menu
があります。SeparatorMenuItem
も、MenuのアイテムObservableListでよく使用されるノードです。
public final boolean isShowing()
ContextMenu
が現在表示されているかどうかを示します。public final ReadOnlyBooleanProperty showingProperty()
ContextMenu
が現在表示されているかどうかを示します。isShowing()
public final void setPopupSide(Side value)
ContextMenu
を開くかを示します。メニュー・アイテムは、通常、いずれの場合も垂直にレイアウトされます。たとえば、メニュー・ボタンがアプリケーションの左端の垂直ツールバーにある場合、popupSide
をSide.RIGHT
に変更すると、MenuButtonの右側にポップアップが表示されるようになります。Side.BOTTOM
public final Side getPopupSide()
ContextMenu
を開くかを示します。メニュー・アイテムは、通常、いずれの場合も垂直にレイアウトされます。たとえば、メニュー・ボタンがアプリケーションの左端の垂直ツールバーにある場合、popupSide
をSide.RIGHT
に変更すると、MenuButtonの右側にポップアップが表示されるようになります。Side.BOTTOM
public final ObjectProperty<Side> popupSideProperty()
ContextMenu
を開くかを示します。メニュー・アイテムは、通常、いずれの場合も垂直にレイアウトされます。たとえば、メニュー・ボタンがアプリケーションの左端の垂直ツールバーにある場合、popupSide
をSide.RIGHT
に変更すると、MenuButtonの右側にポップアップが表示されるようになります。Side.BOTTOM
getPopupSide()
、setPopupSide(Side)
public void show()
ContextMenu
を表示します。Node.isDisabled()
、isShowing()
public void hide()
ContextMenu
を非表示にします。isShowing()
public void fire()
fire
、クラス: ButtonBase
protected Skin<?> createDefaultSkin()
-fx-skin
を介してスキンが提供されていない場合にコントロール用のスキンを作成するために、またはsetSkin(...)
を使用してサブクラスで明示的に設定するために呼び出されます。createDefaultSkin
、クラス: Control
public void executeAccessibleAction(AccessibleAction action, Object... parameters)
executeAccessibleAction
in class ButtonBase
action
- 実行するアクションparameters
- オプションのパラメータ・リスト「AccessibleAction」
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.