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, onActionalignment, contentDisplay, ellipsisString, font, graphic, graphicTextGap, labelPadding, lineSpacing, mnemonicParsing, textAlignment, textFill, textOverrun, text, underline, wrapTextcontextMenu, 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, visibleUSE_COMPUTED_SIZE, USE_PREF_SIZEBASELINE_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, setOnActionalignmentProperty, 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, wrapTextPropertycomputeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, 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, 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, visiblePropertypublic final ReadOnlyBooleanProperty showingProperty
ContextMenuが現在表示されているかどうかを示します。isShowing()public final ObjectProperty<Side> popupSideProperty
ContextMenuを開くかを示します。 メニュー・アイテムは、通常、いずれの場合も垂直にレイアウトされます。 たとえば、メニュー・ボタンがアプリケーションの左端の垂直ツールバーにある場合、popupSideをSide.RIGHTに変更すると、MenuButtonの右側にポップアップが表示されるようになります。 Side.BOTTOMgetPopupSide()、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.BOTTOMpublic final Side getPopupSide()
ContextMenuを開くかを示します。 メニュー・アイテムは、通常、いずれの場合も垂直にレイアウトされます。 たとえば、メニュー・ボタンがアプリケーションの左端の垂直ツールバーにある場合、popupSideをSide.RIGHTに変更すると、MenuButtonの右側にポップアップが表示されるようになります。 Side.BOTTOMpublic final ObjectProperty<Side> popupSideProperty()
ContextMenuを開くかを示します。 メニュー・アイテムは、通常、いずれの場合も垂直にレイアウトされます。 たとえば、メニュー・ボタンがアプリケーションの左端の垂直ツールバーにある場合、popupSideをSide.RIGHTに変更すると、MenuButtonの右側にポップアップが表示されるようになります。 Side.BOTTOMgetPopupSide()、setPopupSide(Side)public void show()
ContextMenuを表示します。Node.isDisabled()、isShowing()public void hide()
ContextMenuを非表示にします。isShowing()public void fire()
fire、クラスButtonBaseprotected Skin<?> createDefaultSkin()
-fx-skinを介してスキンが提供されていない場合にコントロール用のスキンを作成するために、またはsetSkin(...)を使用してサブクラスで明示的に設定するために呼び出されます。 createDefaultSkin、クラスControlpublic void executeAccessibleAction(AccessibleAction action, Object... parameters)
executeAccessibleAction in class ButtonBaseaction - 実行するアクションparameters - オプションのパラメータ・リストAccessibleActionCopyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.