package three.day.frame;
import java.util.Calendar;
import javax.swing.JFrame;
import javax.swing.JSpinner;
import javax.swing.SpinnerModel;
import javax.swing.SpinnerNumberModel;
public class JSpinnerDemo01 {
public static void main(String[] args) {
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
SpinnerModel model = new SpinnerNumberModel(
currentYear,
currentYear-50,
currentYear+50,
1);
JSpinner spinner = new JSpinner(model);
spinner.setBounds(10,10,100,26);
JFrame frame = new JFrame("JSpinner使用实例");
frame.setBounds(200,200,300,230);
frame.setLayout(null);
frame.add(spinner);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}