- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.control.Control
-
- javafx.scene.control.Spinner<T>
-
- 型パラメータ:
T
- Spinner内で反復処理できるすべての値のタイプ。 一般的なタイプにはIntegerやStringがあります。
- すべての実装されたインタフェース:
Styleable
,EventTarget
,Skinnable
public class Spinner<T> extends Control
順序付けられたシーケンスからユーザーが数値またはオブジェクト値を選択できるようにする単一行のテキスト・フィールド。 通常、スピナーはシーケンスの要素間を移動するための小さな矢印ボタンのペアを提供します。 キーボードの上/下矢印キーでも要素間を自由に移動できます。 ユーザーがスピナーに直接(有効な)値を入力することもできます。 コンボ・ボックスも同様の機能を提供しますが、スピナーの方が好まれる場合があるのは、重要なデータを不明瞭化する可能性があるドロップ・ダウン・リストが不要であり、また、他の多くのJavaFX UIコントロールのようにObservableList
データ・モデルを使用せずに、wrapping
などの機能や、より単純な'無限'データ・モデルの仕様(SpinnerValueFactory
)を使用できるためです。Spinnerのシーケンス値は
SpinnerValueFactory
で定義します。 値ファクトリはコンストラクタ引数として指定し、value factory property
を使用して変更できます。 JavaFXには、次に示す一般的なタイプのSpinnerValueFactoryクラスが用意されています。SpinnerValueFactory.IntegerSpinnerValueFactory
SpinnerValueFactory.DoubleSpinnerValueFactory
SpinnerValueFactory.ListSpinnerValueFactory
Spinnerには、Spinnerの現在の
value
の表示および変更を行う、editor
と呼ばれるTextField子コンポーネントがあります。 Spinnerはデフォルトで編集不可能ですが、editable property
をtrueに設定すると、入力を受け入れることができます。 Spinnerエディタは、値ファクトリのvalue property
に対する変更をリスニングすることにより、値ファクトリとの同期を保ちます。 ユーザーがeditorに表示された値を変更した場合、Spinnerのvalue
とeditorの値が異なってしまう可能性があります。 モデルの値をeditorの値と同じにするには、ユーザーが[Enter]キーを使用して編集をコミットする必要があります。- 導入されたバージョン:
- JavaFX 8u40
- 関連項目:
SpinnerValueFactory
-
-
プロパティのサマリー
プロパティ Type プロパティ 説明 BooleanProperty
editable
editableプロパティは、ユーザー入力をSpinnereditor
に入力できるようにするかどうかを指定するために使用します。ReadOnlyObjectProperty<TextField>
editor
Spinnerコントロールで使用するeditor。StringProperty
promptText
プロンプト・テキストが表示されない場合は、Spinner
またはnull
に表示するプロンプト・テキスト。ObjectProperty<SpinnerValueFactory<T>>
valueFactory
値ファクトリはJavaFX Spinner controlの背後にあるモデルであり、値ファクトリが導入されていない場合、Spinnerは使用できません。ReadOnlyObjectProperty<T>
value
Spinnerのvalueプロパティは、SpinnerValueFactoryのvalue property
にバインドされているため、読取り専用です。-
クラス javafx.scene.control.Controlから継承されたプロパティ
contextMenu、skin、tooltip
-
クラスjavafx.scene.Nodeから継承されたプロパティ
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, viewOrder, visible
-
クラス javafx.scene.Parentから継承されたプロパティ
needsLayout
-
クラス javafx.scene.layout.Regionから継承されたプロパティ
background、border、cacheShape、centerShape、height、insets、maxHeight、maxWidth、minHeight、minWidth、opaqueInsets、padding、prefHeight、prefWidth、scaleShape、shape、snapToPixel、width
-
-
フィールドのサマリー
フィールド 修飾子と型 フィールド 説明 static String
STYLE_CLASS_ARROWS_ON_LEFT_HORIZONTAL
水平方向(左向きと右向き)の矢印がSpinnerの左側に配置されます。static String
STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL
垂直方向(上向きと下向き)の矢印がSpinnerの左側に配置されます。static String
STYLE_CLASS_ARROWS_ON_RIGHT_HORIZONTAL
水平方向(左向きと右向き)の矢印がSpinnerの右側に配置されます。static String
STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL
Spinnerの左側に減分矢印、右側に増分矢印が配置されます。static String
STYLE_CLASS_SPLIT_ARROWS_VERTICAL
スピナーの幅全体にわたって上下に伸びた矢印が配置されます。-
クラスjavafx.scene.Nodeから継承されたフィールド
BASELINE_OFFSET_SAME_AS_HEIGHT
-
クラス javafx.scene.layout.Regionから継承されたフィールド
USE_COMPUTED_SIZE、USE_PREF_SIZE
-
-
コンストラクタのサマリー
コンストラクタ コンストラクタ 説明 Spinner()
デフォルトの'spinner'スタイル・クラスおよび編集不可能なエディタを使用して、デフォルトのSpinnerインスタンスを構築します。Spinner(double min, double max, double initialValue)
value factory
をSpinnerValueFactory.DoubleSpinnerValueFactory
のインスタンスに設定して、Spinnerインスタンスを作成します。Spinner(double min, double max, double initialValue, double amountToStepBy)
value factory
をSpinnerValueFactory.DoubleSpinnerValueFactory
のインスタンスに設定して、Spinnerインスタンスを作成します。Spinner(int min, int max, int initialValue)
value factory
をSpinnerValueFactory.IntegerSpinnerValueFactory
のインスタンスに設定して、Spinnerインスタンスを作成します。Spinner(int min, int max, int initialValue, int amountToStepBy)
value factory
をSpinnerValueFactory.IntegerSpinnerValueFactory
のインスタンスに設定して、Spinnerインスタンスを作成します。Spinner(ObservableList<T> items)
value factory
をSpinnerValueFactory.ListSpinnerValueFactory
のインスタンスに設定して、Spinnerインスタンスを作成します。Spinner(SpinnerValueFactory<T> valueFactory)
指定された値ファクトリを設定して、Spinnerインスタンスを作成します。
-
メソッドのサマリー
すべてのメソッド インスタンス・メソッド 具象メソッド 修飾子と型 メソッド 説明 void
cancelEdit()
void
commitValue()
protected Skin<?>
createDefaultSkin()
このコントロールのデフォルト・スキンの新しいインスタンスを作成します。void
decrement()
引数1でSpinnerValueFactory.decrement(int)
メソッドを呼び出すことにより、1ステップずつのvalue factory
の減分を試みます。void
decrement(int steps)
SpinnerValueFactory.decrement(int)
メソッドを呼び出して、ステップ引数をそれに転送することにより、指定したステップ数ずつのvalue factory
の減分を試みます。BooleanProperty
editableProperty()
editableプロパティは、ユーザー入力をSpinnereditor
に入力できるようにするかどうかを指定するために使用します。ReadOnlyObjectProperty<TextField>
editorProperty()
Spinnerコントロールで使用するeditor。void
executeAccessibleAction(AccessibleAction action, Object... parameters)
このメソッドは、引数で指定されたアクションの実行をリクエストするためにアシスティブ・テクノロジによって呼び出されます。TextField
getEditor()
プロパティ・エディタの値を取得します。String
getPromptText()
プロパティpromptTextの値を取得します。T
getValue()
プロパティvalueの値を取得します。SpinnerValueFactory<T>
getValueFactory()
プロパティvalueFactoryの値を取得します。void
increment()
引数1でSpinnerValueFactory.increment(int)
メソッドを呼び出すことにより、1ステップずつのvalue factory
の増分を試みます。void
increment(int steps)
SpinnerValueFactory.increment(int)
メソッドを呼び出して、ステップ引数をそれに転送することにより、指定したステップ数ずつのvalue factory
の増分を試みます。boolean
isEditable()
プロパティeditableの値を取得します。StringProperty
promptTextProperty()
プロンプト・テキストが表示されない場合は、Spinner
またはnull
に表示するプロンプト・テキスト。Object
queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
このメソッドは、属性の値をリクエストするためにアシスティブ・テクノロジによって呼び出されます。void
setEditable(boolean value)
プロパティeditableの値を設定します。void
setPromptText(String value)
プロパティpromptTextの値を設定します。void
setValueFactory(SpinnerValueFactory<T> value)
プロパティvalueFactoryの値を設定します。ObjectProperty<SpinnerValueFactory<T>>
valueFactoryProperty()
値ファクトリはJavaFX Spinner controlの背後にあるモデルであり、値ファクトリが導入されていない場合、Spinnerは使用できません。ReadOnlyObjectProperty<T>
valueProperty()
Spinnerのvalueプロパティは、SpinnerValueFactoryのvalue property
にバインドされているため、読取り専用です。-
クラス javafx.scene.control.Controlから継承されたメソッド
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
-
クラスjavafx.scene.Nodeから継承されたメソッド
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, getInitialCursor, 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, getViewOrder, 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, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
-
クラス java.lang.Objectから継承されたメソッド
clone、equals、finalize、getClass、hashCode、notify、notifyAll、wait、wait、wait
-
クラス javafx.scene.Parentから継承されたメソッド
getChildren、getChildrenUnmodifiable、getManagedChildren、getStylesheets、isNeedsLayout、layout、lookup、needsLayoutProperty、requestLayout、requestParentLayout、setNeedsLayout、updateBounds
-
クラス javafx.scene.layout.Regionから継承されたメソッド
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, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
-
インタフェース javafx.css.Styleableから継承されたメソッド
getStyleableNode
-
-
-
-
プロパティの詳細
-
value
public final ReadOnlyObjectProperty<T> valueProperty
Spinnerのvalueプロパティは、SpinnerValueFactoryのvalue property
にバインドされているため、読取り専用です。value factory
が変更された場合、このvalue propertyは古い値ファクトリへのバインドが解除されて、新しい値ファクトリにバインドされます。開発者がvalue propertyを変更するには、次のフォームのコードを使用します。
Object newValue = ...; spinner.getValueFactory().setValue(newValue);
- 関連項目:
getValue()
-
valueFactory
public final ObjectProperty<SpinnerValueFactory<T>> valueFactoryProperty
値ファクトリはJavaFX Spinner controlの背後にあるモデルであり、値ファクトリが導入されていない場合、Spinnerは使用できません。 次のようなSpinnerのほぼすべての局面を処理するのは、値ファクトリの役割です。
-
editable
public final BooleanProperty editableProperty
editableプロパティは、ユーザー入力をSpinnereditor
に入力できるようにするかどうかを指定するために使用します。 editableがtrueの場合、ユーザーが入力して[Enter]キーを押すと、ユーザー入力が受け入れられます。 この時点で、入力がSpinnerValueFactoryconverter
StringConverter.fromString(String)
メソッドに渡されます。 続いて、この(T型の)コールから返された値がSpinnerValueFactory.setValue(Object)
メソッドに送信されます。 値が有効な場合、その値が保持されます。 値が無効な場合、値ファクトリはそれに応じた処理をし、この変更をバック・アウトする必要があります。
-
editor
public final ReadOnlyObjectProperty<TextField> editorProperty
Spinnerコントロールで使用するeditor。- 関連項目:
getEditor()
-
promptText
public final StringProperty promptTextProperty
プロンプト・テキストが表示されない場合は、Spinner
またはnull
に表示するプロンプト・テキスト。- 導入されたバージョン:
- 9
- 関連項目:
getPromptText()
、setPromptText(String)
-
-
フィールドの詳細
-
STYLE_CLASS_ARROWS_ON_RIGHT_HORIZONTAL
public static final String STYLE_CLASS_ARROWS_ON_RIGHT_HORIZONTAL
水平方向(左向きと右向き)の矢印がSpinnerの右側に配置されます。- 関連項目:
- 定数フィールド値
-
STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL
public static final String STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL
垂直方向(上向きと下向き)の矢印がSpinnerの左側に配置されます。- 関連項目:
- 定数フィールド値
-
STYLE_CLASS_ARROWS_ON_LEFT_HORIZONTAL
public static final String STYLE_CLASS_ARROWS_ON_LEFT_HORIZONTAL
水平方向(左向きと右向き)の矢印がSpinnerの左側に配置されます。- 関連項目:
- 定数フィールド値
-
STYLE_CLASS_SPLIT_ARROWS_VERTICAL
public static final String STYLE_CLASS_SPLIT_ARROWS_VERTICAL
スピナーの幅全体にわたって上下に伸びた矢印が配置されます。- 関連項目:
- 定数フィールド値
-
-
コンストラクタの詳細
-
Spinner
public Spinner()
デフォルトの'spinner'スタイル・クラスおよび編集不可能なエディタを使用して、デフォルトのSpinnerインスタンスを構築します。
-
Spinner
public Spinner(int min, int max, int initialValue)
value factory
をSpinnerValueFactory.IntegerSpinnerValueFactory
のインスタンスに設定して、Spinnerインスタンスを作成します。 このコンストラクタが呼び出された場合、Spinnerインスタンスの有効な汎用型はIntegerのみ(Spinner<Integer>)であることに注意してください。- パラメータ:
min
- Spinnerの最小許容integer値。max
- Spinnerの最大許容integer値。initialValue
- 最初のインスタンス化時のSpinnerの値はmin引数とmax引数の範囲内にある必要があり、そうでない場合はminの値が使用されます。
-
Spinner
public Spinner(int min, int max, int initialValue, int amountToStepBy)
value factory
をSpinnerValueFactory.IntegerSpinnerValueFactory
のインスタンスに設定して、Spinnerインスタンスを作成します。 このコンストラクタが呼び出された場合、Spinnerインスタンスの有効な汎用型はIntegerのみ(Spinner<Integer>)であることに注意してください。- パラメータ:
min
- Spinnerの最小許容integer値。max
- Spinnerの最大許容integer値。initialValue
- 最初のインスタンス化時のSpinnerの値はmin引数とmax引数の範囲内にある必要があり、そうでない場合はminの値が使用されます。amountToStepBy
- 増分または減分するステップの量。
-
Spinner
public Spinner(double min, double max, double initialValue)
value factory
をSpinnerValueFactory.DoubleSpinnerValueFactory
のインスタンスに設定して、Spinnerインスタンスを作成します。 このコンストラクタが呼び出された場合、Spinnerインスタンスの有効な汎用型はDoubleのみ(Spinner<Double>)であることに注意してください。- パラメータ:
min
- Spinnerの最小許容double値。max
- Spinnerの最大許容double値。initialValue
- 最初のインスタンス化時のSpinnerの値はmin引数とmax引数の範囲内にある必要があり、そうでない場合はminの値が使用されます。
-
Spinner
public Spinner(double min, double max, double initialValue, double amountToStepBy)
value factory
をSpinnerValueFactory.DoubleSpinnerValueFactory
のインスタンスに設定して、Spinnerインスタンスを作成します。 このコンストラクタが呼び出された場合、Spinnerインスタンスの有効な汎用型はDoubleのみ(Spinner<Double>)であることに注意してください。- パラメータ:
min
- Spinnerの最小許容double値。max
- Spinnerの最大許容double値。initialValue
- 最初のインスタンス化時のSpinnerの値はmin引数とmax引数の範囲内にある必要があり、そうでない場合はminの値が使用されます。amountToStepBy
- 増分または減分するステップの量。
-
Spinner
public Spinner(ObservableList<T> items)
value factory
をSpinnerValueFactory.ListSpinnerValueFactory
のインスタンスに設定して、Spinnerインスタンスを作成します。 Spinnerのvalue property
は、要素が存在する場合はリストの最初の要素に設定され、存在しない場合はnullになります。- パラメータ:
items
- Spinner内でステップ実行されるアイテムのリスト。
-
Spinner
public Spinner(SpinnerValueFactory<T> valueFactory)
指定された値ファクトリを設定して、Spinnerインスタンスを作成します。- パラメータ:
valueFactory
- 使用するvalue factory
。
-
-
メソッドの詳細
-
increment
public void increment()
引数1でSpinnerValueFactory.increment(int)
メソッドを呼び出すことにより、1ステップずつのvalue factory
の増分を試みます。 value factoryがnullの場合、IllegalStateExceptionがスローされます。- 例外:
IllegalStateException
-getValueFactory()
を呼び出すことによって返されたvalue factoryがnullの場合。
-
increment
public void increment(int steps)
SpinnerValueFactory.increment(int)
メソッドを呼び出して、ステップ引数をそれに転送することにより、指定したステップ数ずつのvalue factory
の増分を試みます。 value factoryがnullの場合、IllegalStateExceptionがスローされます。- パラメータ:
steps
- 値に対して実行する増分の数。- 例外:
IllegalStateException
-getValueFactory()
を呼び出すことによって返されたvalue factoryがnullの場合。
-
decrement
public void decrement()
引数1でSpinnerValueFactory.decrement(int)
メソッドを呼び出すことにより、1ステップずつのvalue factory
の減分を試みます。 value factoryがnullの場合、IllegalStateExceptionがスローされます。- 例外:
IllegalStateException
-getValueFactory()
を呼び出すことによって返されたvalue factoryがnullの場合。
-
decrement
public void decrement(int steps)
SpinnerValueFactory.decrement(int)
メソッドを呼び出して、ステップ引数をそれに転送することにより、指定したステップ数ずつのvalue factory
の減分を試みます。 value factoryがnullの場合、IllegalStateExceptionがスローされます。- パラメータ:
steps
- 値に対して実行する減分の数。- 例外:
IllegalStateException
-getValueFactory()
を呼び出すことによって返されたvalue factoryがnullの場合。
-
createDefaultSkin
protected Skin<?> createDefaultSkin()
このコントロールのデフォルト・スキンの新しいインスタンスを作成します。 これは、CSS-fx-skin
を介してスキンが提供されていない場合にコントロール用のスキンを作成するために、またはsetSkin(...)
を使用してサブクラスで明示的に設定するために呼び出されます。- オーバーライド:
createDefaultSkin
、クラス:Control
- 戻り値:
- このコントロールのデフォルト・スキンの新しいインスタンス。 nullの場合、コントロールにはスキンがありません(Cssで提供されている場合を除く)。
-
commitValue
public final void commitValue()
- 導入されたバージョン:
- 9
-
cancelEdit
public final void cancelEdit()
- 導入されたバージョン:
- 9
-
getValue
public final T getValue()
プロパティvalueの値を取得します。- プロパティの説明:
- Spinnerのvalueプロパティは、SpinnerValueFactoryの
value property
にバインドされているため、読取り専用です。value factory
が変更された場合、このvalue propertyは古い値ファクトリへのバインドが解除されて、新しい値ファクトリにバインドされます。開発者がvalue propertyを変更するには、次のフォームのコードを使用します。
Object newValue = ...; spinner.getValueFactory().setValue(newValue);
-
valueProperty
public final ReadOnlyObjectProperty<T> valueProperty()
Spinnerのvalueプロパティは、SpinnerValueFactoryのvalue property
にバインドされているため、読取り専用です。value factory
が変更された場合、このvalue propertyは古い値ファクトリへのバインドが解除されて、新しい値ファクトリにバインドされます。開発者がvalue propertyを変更するには、次のフォームのコードを使用します。
Object newValue = ...; spinner.getValueFactory().setValue(newValue);
- 関連項目:
getValue()
-
setValueFactory
public final void setValueFactory(SpinnerValueFactory<T> value)
プロパティvalueFactoryの値を設定します。
-
getValueFactory
public final SpinnerValueFactory<T> getValueFactory()
プロパティvalueFactoryの値を取得します。
-
valueFactoryProperty
public final ObjectProperty<SpinnerValueFactory<T>> valueFactoryProperty()
値ファクトリはJavaFX Spinner controlの背後にあるモデルであり、値ファクトリが導入されていない場合、Spinnerは使用できません。 次のようなSpinnerのほぼすべての局面を処理するのは、値ファクトリの役割です。
-
setEditable
public final void setEditable(boolean value)
プロパティeditableの値を設定します。- プロパティの説明:
- editableプロパティは、ユーザー入力をSpinner
editor
に入力できるようにするかどうかを指定するために使用します。 editableがtrueの場合、ユーザーが入力して[Enter]キーを押すと、ユーザー入力が受け入れられます。 この時点で、入力がSpinnerValueFactoryconverter
StringConverter.fromString(String)
メソッドに渡されます。 続いて、この(T型の)コールから返された値がSpinnerValueFactory.setValue(Object)
メソッドに送信されます。 値が有効な場合、その値が保持されます。 値が無効な場合、値ファクトリはそれに応じた処理をし、この変更をバック・アウトする必要があります。
-
isEditable
public final boolean isEditable()
プロパティeditableの値を取得します。- プロパティの説明:
- editableプロパティは、ユーザー入力をSpinner
editor
に入力できるようにするかどうかを指定するために使用します。 editableがtrueの場合、ユーザーが入力して[Enter]キーを押すと、ユーザー入力が受け入れられます。 この時点で、入力がSpinnerValueFactoryconverter
StringConverter.fromString(String)
メソッドに渡されます。 続いて、この(T型の)コールから返された値がSpinnerValueFactory.setValue(Object)
メソッドに送信されます。 値が有効な場合、その値が保持されます。 値が無効な場合、値ファクトリはそれに応じた処理をし、この変更をバック・アウトする必要があります。
-
editableProperty
public final BooleanProperty editableProperty()
editableプロパティは、ユーザー入力をSpinnereditor
に入力できるようにするかどうかを指定するために使用します。 editableがtrueの場合、ユーザーが入力して[Enter]キーを押すと、ユーザー入力が受け入れられます。 この時点で、入力がSpinnerValueFactoryconverter
StringConverter.fromString(String)
メソッドに渡されます。 続いて、この(T型の)コールから返された値がSpinnerValueFactory.setValue(Object)
メソッドに送信されます。 値が有効な場合、その値が保持されます。 値が無効な場合、値ファクトリはそれに応じた処理をし、この変更をバック・アウトする必要があります。
-
editorProperty
public final ReadOnlyObjectProperty<TextField> editorProperty()
Spinnerコントロールで使用するeditor。- 関連項目:
getEditor()
-
getEditor
public final TextField getEditor()
プロパティ・エディタの値を取得します。- プロパティの説明:
- Spinnerコントロールで使用するeditor。
-
promptTextProperty
public final StringProperty promptTextProperty()
プロンプト・テキストが表示されない場合は、Spinner
またはnull
に表示するプロンプト・テキスト。- 導入されたバージョン:
- 9
- 関連項目:
getPromptText()
、setPromptText(String)
-
getPromptText
public final String getPromptText()
プロパティpromptTextの値を取得します。- プロパティの説明:
- プロンプト・テキストが表示されない場合は、
Spinner
またはnull
に表示するプロンプト・テキスト。 - 導入されたバージョン:
- 9
-
setPromptText
public final void setPromptText(String value)
プロパティpromptTextの値を設定します。- プロパティの説明:
- プロンプト・テキストが表示されない場合は、
Spinner
またはnull
に表示するプロンプト・テキスト。 - 導入されたバージョン:
- 9
-
queryAccessibleAttribute
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
このメソッドは、属性の値をリクエストするためにアシスティブ・テクノロジによって呼び出されます。このメソッドは一般に、特定の役割に必要な属性を実装するためにサブクラスによってオーバーライドされます。
特定の属性が処理されない場合は、スーパークラスの実装を呼び出す必要があります。- オーバーライド:
queryAccessibleAttribute
、クラス:Control
- パラメータ:
attribute
- リクエストされた属性parameters
- オプションのパラメータ・リスト- 戻り値:
- リクエストされた属性の値
- 関連項目:
AccessibleAttribute
-
executeAccessibleAction
public void executeAccessibleAction(AccessibleAction action, Object... parameters)
このメソッドは、引数で指定されたアクションの実行をリクエストするためにアシスティブ・テクノロジによって呼び出されます。このメソッドは一般に、特定の役割に必要なアクションを実装するためにサブクラスによってオーバーライドされます。
特定のアクションが処理されない場合は、スーパークラスの実装を呼び出す必要があります。- オーバーライド:
executeAccessibleAction
、クラス:Control
- パラメータ:
action
- 実行するアクションparameters
- オプションのパラメータ・リスト- 関連項目:
「AccessibleAction」
-
-