Since a JSpinner provides the spinning capability to a variety of list of choices, it depends heavily on its model for its creation. In fact, you must provide a model for the JSpinner in its constructor unless you want a trivial JSpinner with just a list of integers. It supports three different kinds of ordered lists of choices: a list of numbers, a list of dates, and a list of any other objects. It provides three classes to create a model of three different kinds of lists:
- SpinnerNumberModel
- SpinnerDateModel
- SpinnerListModel
A spinner model is an instance of the SpinnerModel interface. It defines the getValue(), setValue(), getPreviousValue(), and getNextValue() methods to work with values in the JSpinner. All these methods work with objects ...
Get Beginning Java 8 APIs, Extensions and Libraries Swing, JavaFX, JavaScript, JDBC and Network Programming APIs now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.