Java examples for Swing:JSpinner
SpinnerDateModel for an ordered list of dates.
import java.util.Calendar; import java.util.Date; import javax.swing.JSpinner; import javax.swing.SpinnerDateModel; public class Main { public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); calendar.set(1950, 1, 1);/*from ww w . j a va 2 s. c o m*/ Date minValue = calendar.getTime(); calendar.set(2050, 12, 31); Date maxValue = calendar.getTime(); Date currentValue = new Date(); int steps = Calendar.DAY_OF_MONTH; // Must be a Calendar field SpinnerDateModel dModel = new SpinnerDateModel(currentValue, minValue, maxValue, steps); JSpinner dateSpinner = new JSpinner(dModel); } }