new SpinnerDateModel()
import java.awt.BorderLayout;
import java.text.DateFormatSymbols;
import java.util.Locale;
import javax.swing.JFrame;
import javax.swing.JSpinner;
import javax.swing.SpinnerDateModel;
import javax.swing.SpinnerListModel;
import javax.swing.SpinnerModel;
public class MainClass {
public static void main(String args[]) {
JFrame f = new JFrame("JSpinner Sample");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
DateFormatSymbols symbols = new DateFormatSymbols(Locale.FRENCH);
String days[] = symbols.getWeekdays();
SpinnerModel model1 = new SpinnerListModel(days);
SpinnerModel model2 = new SpinnerDateModel();
JSpinner spinner1 = new JSpinner(model1);
JSpinner spinner2 = new JSpinner(model2);
f.add(spinner1, BorderLayout.NORTH);
f.add(spinner2, BorderLayout.SOUTH);
f.setSize(300, 100);
f.setVisible(true);
}
}
Related examples in the same category