Document FX and injection and integrate the Designer reference example
This commit is contained in:
@@ -12,3 +12,15 @@ the editor. Increment/decrement use the normal JavaFX spinner behavior.
|
||||
|
||||
The factory rejects negative/inverted bounds and out-of-range initial values.
|
||||
Applications own their field labels, units, and domain-specific bounds.
|
||||
|
||||
|
||||
Create and add a spinner in a controller's `initialize` method or in `Application.start`:
|
||||
|
||||
```java
|
||||
Spinner<Integer> quantity = IntegerSpinners.nonNegative(0, 100, 1);
|
||||
quantity.valueProperty().addListener((observable, oldValue, newValue) ->
|
||||
System.out.println("Quantity: " + newValue));
|
||||
container.getChildren().add(quantity);
|
||||
```
|
||||
|
||||
Import `javafx.scene.control.Spinner` and `de.neitzel.fx.control.IntegerSpinners`; `container` is your Pane. Read `quantity.getValue()` to obtain the committed number. Set a programmatic value through `quantity.getValueFactory().setValue(...)`. Use the factory's bounds as UI constraints and keep independent business validation where the value is saved. The helper does not add an FXML binding declaration or create a Model Attribute automatically.
|
||||
|
||||
Reference in New Issue
Block a user