java - Settings SpinnerDateModel's start, end, and CalendarField returns invalid calendarField exception -
i need in settings start value, end value , step or increments of jspinner
containing time value in "hh:mm" format.
i've been trying fix error 2 hours now.
calendar value = calendar.getinstance(); value.set(calendar.hour_of_day, 7); value.set(calendar.minute, 0); calendar start = calendar.getinstance(); start.set(calendar.hour_of_day, 7); start.set(calendar.minute, 0); calendar end = calendar.getinstance(); end.set(calendar.hour_of_day, 18); end.set(calendar.minute, 0); calendar step = calendar.getinstance(); step.set(calendar.hour_of_day,00); step.set(calendar.minute, 15); model = new spinnerdatemodel(); model.setvalue(value.gettime()); model.setstart(start.gettime()); model.setend(end.gettime()); model.setcalendarfield(step.get(calendar.minute)); spinner = new jspinner(model); editor = new jspinner.dateeditor(spinner, "hh:mm"); editor.gettextfield().seteditable(true); spinner.seteditor(editor);
what want achieve spinner's
value = 7:00am
start = 7:00am
end = 6pm or 18:00
increments/step = 7:00 -> 7:15 -> 7:30 -> 7:45
the value
working correctly , starts 7:00am however, i'm having problems setting value start, end , step
when run code, exception error message'
exception in thread "awt-eventqueue-0" java.lang.illegalargumentexception: invalid calendarfield
how can set jspinner?
thank you.
Comments
Post a Comment