@DefaultProperty(value="items") public class ChoiceBox<T> extends Control
デフォルトでは、ChoiceBoxには選択されているアイテムはありません(他に指定されている場合を除く)。ChoiceBoxでは、ユーザーは事前定義済リストからの選択のみ可能ですが、開発者は、事前定義済リストで使用できないアイテムを選択済アイテムとして指定できます。このことは、いくつかの重要なユースケースで必要となります。
ChoiceBoxの構成は順序非依存です。アイテムを指定してから選択済アイテムを指定したり、選択済アイテムを指定してからアイテムを指定することができます。いずれの方法も正常に機能します。
ChoiceBoxアイテムの選択は、SelectionModel
によって処理されます。ListViewおよびComboBoxと同様、使用されるSelectionModel
を変更できます(ただし、変更されることはほとんどありません)。ChoiceBoxは、使用されるデフォルトがSingleSelectionModel
であるため、単一選択モデルのみをサポートします。
import javafx.scene.control.ChoiceBox; ChoiceBox cb = new ChoiceBox(); cb.getItems().addAll("item1", "item2", "item3");
Type | プロパティと説明 |
---|---|
ObjectProperty<StringConverter<T>> |
converter
アイテム・リストでオブジェクトを表す方法を指定できるようにします。
|
ObjectProperty<ObservableList<T>> |
items
選択ボックスに表示するアイテム。
|
ObjectProperty<SingleSelectionModel<T>> |
selectionModel
ChoiceBoxの選択モデル。
|
ReadOnlyBooleanProperty |
showing
ドロップ・ダウンで選択のリストがユーザーに表示されているかどうかを示します。
|
ObjectProperty<T> |
value
このChoiceBoxの値は、ChoiceBox選択モデルの選択項目として定義されます。
|
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
コンストラクタと説明 |
---|
ChoiceBox()
空のアイテム・リストを持つ、新しいChoiceBoxを作成します。
|
ChoiceBox(ObservableList<T> items)
指定されたアイテム・セットを含む新しいChoiceBoxを作成します。
|
修飾子と型 | メソッドと説明 |
---|---|
ObjectProperty<StringConverter<T>> |
converterProperty()
アイテム・リストでオブジェクトを表す方法を指定できるようにします。
|
protected Skin<?> |
createDefaultSkin()
このコントロールのデフォルト・スキンの新しいインスタンスを作成します。
|
void |
executeAccessibleAction(AccessibleAction action, Object... parameters)
このメソッドは、引数で指定されたアクションの実行をリクエストするためにアシスティブ・テクノロジによって呼び出されます。
|
StringConverter<T> |
getConverter()
プロパティconverterの値を取得します。
|
ObservableList<T> |
getItems()
プロパティ・アイテムの値を取得します。
|
SingleSelectionModel<T> |
getSelectionModel()
プロパティselectionModelの値を取得します。
|
T |
getValue()
プロパティvalueの値を取得します。
|
void |
hide()
選択のリストを閉じます。
|
boolean |
isShowing()
プロパティshowingの値を取得します。
|
ObjectProperty<ObservableList<T>> |
itemsProperty()
選択ボックスに表示するアイテム。
|
Object |
queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
*アクセシビリティ処理* *
|
ObjectProperty<SingleSelectionModel<T>> |
selectionModelProperty()
ChoiceBoxの選択モデル。
|
void |
setConverter(StringConverter<T> value)
プロパティconverterの値を設定します。
|
void |
setItems(ObservableList<T> value)
プロパティ・アイテムの値を設定します。
|
void |
setSelectionModel(SingleSelectionModel<T> value)
プロパティselectionModelの値を設定します。
|
void |
setValue(T value)
プロパティvalueの値を設定します。
|
void |
show()
選択のリストを開きます。
|
ReadOnlyBooleanProperty |
showingProperty()
ドロップ・ダウンで選択のリストがユーザーに表示されているかどうかを示します。
|
ObjectProperty<T> |
valueProperty()
このChoiceBoxの値は、ChoiceBox選択モデルの選択項目として定義されます。
|
computeMaxHeight、computeMaxWidth、computeMinHeight、computeMinWidth、computePrefHeight、computePrefWidth、contextMenuProperty、getBaselineOffset、getClassCssMetaData、getContextMenu、getControlCssMetaData、getCssMetaData、getSkin、getTooltip、isResizable、layoutChildren、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、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、visibleProperty
public final ObjectProperty<SingleSelectionModel<T>> selectionModelProperty
public final ReadOnlyBooleanProperty showingProperty
isShowing()
public final ObjectProperty<ObservableList<T>> itemsProperty
public ObjectProperty<StringConverter<T>> converterProperty
javafx.util.converter
パッケージで使用可能な事前構築済コンバータを設定できます。getConverter()
、setConverter(StringConverter)
public ObjectProperty<T> valueProperty
getValue()
、setValue(T)
public ChoiceBox()
public ChoiceBox(ObservableList<T> items)
items
- public final void setSelectionModel(SingleSelectionModel<T> value)
public final SingleSelectionModel<T> getSelectionModel()
public final ObjectProperty<SingleSelectionModel<T>> selectionModelProperty()
public final boolean isShowing()
public final ReadOnlyBooleanProperty showingProperty()
isShowing()
public final void setItems(ObservableList<T> value)
public final ObservableList<T> getItems()
public final ObjectProperty<ObservableList<T>> itemsProperty()
public ObjectProperty<StringConverter<T>> converterProperty()
javafx.util.converter
パッケージで使用可能な事前構築済コンバータを設定できます。getConverter()
、setConverter(StringConverter)
public final void setConverter(StringConverter<T> value)
javafx.util.converter
パッケージで使用可能な事前構築済コンバータを設定できます。public final StringConverter<T> getConverter()
javafx.util.converter
パッケージで使用可能な事前構築済コンバータを設定できます。public ObjectProperty<T> valueProperty()
getValue()
、setValue(T)
public final void setValue(T value)
public final T getValue()
public void show()
public void hide()
protected Skin<?> createDefaultSkin()
-fx-skin
を介してスキンが提供されていない場合にコントロール用のスキンを作成するために、またはsetSkin(...)
を使用してサブクラスで明示的に設定するために呼び出されます。createDefaultSkin
、クラス: Control
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
queryAccessibleAttribute
、クラス: Control
attribute
- リクエストされた属性parameters
- オプションのパラメータ・リストAccessibleAttribute
public void executeAccessibleAction(AccessibleAction action, Object... parameters)
Node
このメソッドは一般に、特定の役割に必要なアクションを実装するためにサブクラスによってオーバーライドされます。
特定のアクションが処理されない場合、スーパー・クラス実装を呼び出す必要があります。
executeAccessibleAction
、クラス: Control
action
- 実行するアクションparameters
- オプションのパラメータ・リスト「AccessibleAction」
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.