Example usage for javax.swing JSpinner getPreviousValue

List of usage examples for javax.swing JSpinner getPreviousValue

Introduction

In this page you can find the example usage for javax.swing JSpinner getPreviousValue.

Prototype

@BeanProperty(bound = false)
public Object getPreviousValue() 

Source Link

Document

Returns the object in the sequence that comes before the object returned by getValue().

Usage

From source file:Main.java

public Main() {
    super("Month Spinner");
    setSize(200, 100);/*from   ww  w  .ja  va2s  .c  o m*/
    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();
    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);

    System.out.println(s.getPreviousValue());
}