Hi,
Please study following example of SpinnerListModel class, which will depict you the use of this class:
Code:
import javax.swing.JSpinner;
import javax.swing.SpinnerListModel;
import javax.swing.SpinnerModel;
public class MainClass1 {
public static void main(final String args[]) {
JFrame frameC = new JFrame("JSpinner Dates");
frameC.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
SpinnerModel modelC1 = new SpinnerListModel();
JSpinner spinnerC1 = new JSpinner(modelC1);
JLabel labelC1 = new JLabel("None");
JPanel panelC1 = new JPanel(new BorderLayout());
panel1.add(labelC1, BorderLayout.CENTER);
panel1.add(spinnerC1, BorderLayout.WEST);
frame.add(panelC1, BorderLayout.NORTH);
frame.setSize(300, 80);
frame.setVisible(true);
}
}
Bookmarks