代码:
1 //获得时间日期模型 2 SpinnerDateModel model = new SpinnerDateModel(); 3 //获得JSPinner对象 4 JSpinner year = new JSpinner(model); 5 year.setValue(new Date()); 6 //设置时间格式 7 JSpinner.DateEditor editor = new JSpinner.DateEditor(year, 8 "yyyy-MM-dd HH:mm:ss"); 9 year.setEditor(editor);10 year.setBounds(34, 67, 219, 22);11 contentPane.add(year);