如何用 JSpinner 做日历
我用 JSpinner 做日历,不知道怎么把年和月分别放入两个JSpinner 中
------解决方案--------------------类似的代码 :
JSpinner spTime = new JSpinner();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss "); SpinnerDateModel sdm = new SpinnerDateModel();
sdm.setCalendarField(Calendar.DATE);
String pattern = ((SimpleDateFormat) DateFormat.getDateInstance()).toPattern();
spTime.setModel(sdm);
spTime.setEditor(new JSpinner.DateEditor(spTime, "HH:mm:ss "));