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






new JSpinner(SpinnerModel model1) (SpinnerDateModel)

 

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerDateModel;
import javax.swing.SpinnerModel;

public class MainClass {

  public static void main(final String args[]) {
    JFrame frame = new JFrame("JSpinner Dates");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    SpinnerModel model1 = new SpinnerDateModel();
    JSpinner spinner1 = new JSpinner(model1);
    JLabel label1 = new JLabel("All");
    JPanel panel1 = new JPanel(new BorderLayout());
    panel1.add(label1, BorderLayout.WEST);
    panel1.add(spinner1, BorderLayout.CENTER);
    frame.add(panel1, BorderLayout.NORTH);

    frame.setSize(200, 90);
    frame.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 model2)
4.JSpinner: addChangeListener(ChangeListener lis)
5.JSpinner: getModel()
6.JSpinner: setEditor(JComponent editor)
7.JSpinner: setValue(Object value)