new JSpinner(SpinnerModel model2) : JSpinner « javax.swing « Java by API






new JSpinner(SpinnerModel model2)

 
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

1.new JSpinner.DateEditor(JSpinner spinner, String dateFormatPattern)
2.JSpinner.NumberEditor.NumberEditor(JSpinner spinner)
3.new JSpinner(SpinnerModel model1) (SpinnerDateModel)
4.JSpinner: addChangeListener(ChangeListener lis)
5.JSpinner: getModel()
6.JSpinner: setEditor(JComponent editor)
7.JSpinner: setValue(Object value)