import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JSpinner;
import javax.swing.SpinnerDateModel;
import javax.swing.SpinnerListModel;
import javax.swing.SpinnerNumberModel;
public class Main extends JFrame {
public Main() {
JSpinner m_dateSpinner;
SpinnerDateModel m_dateSpinnerModel;
Calendar rightNow = Calendar.getInstance();
Date current = rightNow.getTime();
rightNow.set(Calendar.HOUR_OF_DAY, -24);
Date start = rightNow.getTime();
rightNow.set(Calendar.HOUR_OF_DAY, 48);
Date end = rightNow.getTime();
int step = Calendar.HOUR_OF_DAY;
m_dateSpinnerModel = new SpinnerDateModel(current, start, end, step);
m_dateSpinner = new JSpinner(m_dateSpinnerModel);
add(m_dateSpinner);
}
public static void main(String argv[]) {
Main spinnerFrame = new Main();
spinnerFrame.setSize(350, 200);
spinnerFrame.setVisible(true);
}
}
|