FileDocCategorySizeDatePackage
MonthSpinner.javaAPI DocExample970Thu Oct 24 20:14:22 BST 2002None

MonthSpinner

public class MonthSpinner extends JFrame

Fields Summary
Constructors Summary
public MonthSpinner()

    super("Month Spinner");
    setSize(200,100);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    Container c = getContentPane();
    c.setLayout(new FlowLayout(FlowLayout.LEFT, 4,4));

    c.add(new JLabel("Expiration Date:"));
    Date today = new Date();
    // Start the spinner today, but don't set a min or max date
    // The increment should be a month
    JSpinner s = new JSpinner(new SpinnerDateModel(today, 
                 null, null, Calendar.MONTH));
    JSpinner.DateEditor de = new JSpinner.DateEditor(s, "MM/yy");
    s.setEditor(de);
    c.add(s);

    setVisible(true);
  
Methods Summary
public static voidmain(java.lang.String[] args)

    new MonthSpinner();