scalafxml icon indicating copy to clipboard operation
scalafxml copied to clipboard

Using Spinner with fxml

Open ysksuzuki opened this issue 10 years ago • 1 comments

Hi, Can I use Spinner which has been added since JavaFX 8u40 with scalafxml? NPE was thrown when I tried it. https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/Spinner.html

ysksuzuki avatar Jun 28 '15 08:06 ysksuzuki

Yes. You can use Spinner. You add it in FXML than in Scala you can add its value factory. Here is a snippet that is using a Spinner with integer values:

@sfxml
class MyView(val animationFramesSpinner: Spinner[Integer],
             ...
             val model: MyModel) {

  animationFramesSpinner.valueFactory = new IntegerSpinnerValueFactory(0, 100, 0, 1)
  ...
}

jpsacha avatar Oct 21 '16 01:10 jpsacha