public JSpinner() JSpinner spinner = new JSpinner(); public JSpinner(SpinnerModel model) SpinnerModel model = new SpinnerListModel(args); JSpinner spinner = new JSpinner(model);
public interface SpinnerModel { // Properties public Object getValue(); public void setValue(Object); public Object getNextValue(); public Object getPreviousValue(); // Listeners public void addChangeListener(ChangeListener); public void removeChangeListener(ChangeListener); }
public SpinnerDateModel()SpinnerModel model = new SpinnerDateModel();JSpinner spinner = new JSpinner(model);public SpinnerDateModel(Date value, Comparable start, Comparable end, int calendarField)Calendar cal = Calendar.getInstance();Date now = cal.getTime();cal.add(Calendar.YEAR, -50);Date startDate = cal.getTime();cal.add(Calendar.YEAR, 100);Date endDate = cal.getTime();SpinnerModel model = new SpinnerDateModel(now, startDate, endDate, Calendar.YEAR);JSpinner spinner = new JSpinner(model);
public SpinnerListModel()SpinnerModel model = new SpinnerListModel(); JSpinner spinner = new JSpinner(model); public SpinnerListModel(List<?> values)List<String> list = args; SpinnerModel model = new SpinnerListModel(list); JSpinner spinner = new JSpinner(model); public SpinnerListModel(Object[] values)SpinnerModel model = new SpinnerListModel(args); JSpinner spinner = new JSpinner(model);
public SpinnerNumberModel()SpinnerModel model = new SpinnerNumberModel(); JSpinner spinner = new JSpinner(model); public SpinnerNumberModel(double value, double minimum, double maximum, double stepSize)SpinnerModel model = new SpinnerNumberModel(50, 0, 100, .25); JSpinner spinner = new JSpinner(model); public SpinnerNumberModel(int value, int minimum, int maximum, int stepSize)SpinnerModel model = new SpinnerNumberModel(50, 0, 100, 1); JSpinner spinner = new JSpinner(model); public SpinnerNumberModel(Number value, Comparable minimum, Comparable maximum, Number stepSize)Number value = new Integer(50); Number min = new Integer(0);Number max = new Integer(100); Number step = new Integer(1);SpinnerModel model = new SpinnerNumberModel(value, min, max, step); JSpinner spinner = new JSpinner(model);
public JSpinner.DateEditor(JSpinner spinner)SpinnerModel model = new SpinnerDateModel(); JSpinner spinner = new JSpinner(model);JComponent editor = JSpinner.DateEditor(spinner); spinner.setEditor(editor); public JSpinner.DateEditor(JSpinner spinner, String dateFormatPattern)SpinnerModel model = new SpinnerDateModel(); JSpinner spinner = new JSpinner(model); JComponent editor = JSpinner.DateEditor(spinner, "MMMM yyyy"); spinner.setEditor(editor);