java - Change jspinner (date) min and max values from (database) variables SOLVED FOR MIN -
so problem, i pull data set database, , populate combobox it.
so can see in shoot http://prntscr.com/7bscob .. min , max jspinner values should depend on combobox selected item.
so i've tried set minimal value dynamically, sends illegalargumentexception @ line did that.
for(int i=0; i<turniri.size(); i++) { if (turniri.get(i).getnaziv().equals(selectedturnir)) { t=turniri.get(i).getid(); long l = turniri.get(i).getdatumpocetka().gettime(); spinner.setmodel(new spinnerdatemodel(new date(1431986400000l), new date(l), new date(1433109600000l), calendar.day_of_year)); } }
edit:
thanks @dragondraikk
exception in thread "awt-eventqueue-0" java.lang.illegalargumentexception: (start <= value <= end) false @ javax.swing.spinnerdatemodel.<init>(unknown source) @ gui.izvjestajrezultatazajedantakmicarskidan$3.actionperformed(izvjestajrezultatazajedantakmicarskidan.java:212) @ javax.swing.jcombobox.fireactionevent(unknown source) @ javax.swing.jcombobox.setselecteditem(unknown source) @ javax.swing.jcombobox.setselectedindex(unknown source) @ javax.swing.plaf.basic.basiccombopopup$handler.mousereleased(unknown source) @ java.awt.awteventmulticaster.mousereleased(unknown source) @ java.awt.component.processmouseevent(unknown source) @ javax.swing.jcomponent.processmouseevent(unknown source) @ javax.swing.plaf.basic.basiccombopopup$1.processmouseevent(unknown source) @ java.awt.component.processevent(unknown source) @ java.awt.container.processevent(unknown source) @ java.awt.component.dispatcheventimpl(unknown source) @ java.awt.container.dispatcheventimpl(unknown source) @ java.awt.component.dispatchevent(unknown source) @ java.awt.lightweightdispatcher.retargetmouseevent(unknown source) @ java.awt.lightweightdispatcher.processmouseevent(unknown source) @ java.awt.lightweightdispatcher.dispatchevent(unknown source) @ java.awt.container.dispatcheventimpl(unknown source) @ java.awt.window.dispatcheventimpl(unknown source) @ java.awt.component.dispatchevent(unknown source) @ java.awt.eventqueue.dispatcheventimpl(unknown source) @ java.awt.eventqueue.access$500(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.awt.eventqueue$4.run(unknown source) @ java.awt.eventqueue$4.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.awt.eventqueue.dispatchevent(unknown source) @ java.awt.eventdispatchthread.pumponeeventforfilters(unknown source) @ java.awt.eventdispatchthread.pumpeventsforfilter(unknown source) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(unknown source) @ java.awt.eventdispatchthread.pumpevents(unknown source) @ java.awt.eventdispatchthread.pumpevents(unknown source) @ java.awt.eventdispatchthread.run(unknown source)
so happened here initial data before minimal set data.
looks long l = turniri.get(i).getdatumpocetka().gettime()
somehow incorrect.
according error value in spinnerdatemodel must between min , max.
new spinnerdatemodel(new date(1431986400000l), new date(l), new date(1433109600000l), calendar.day_of_year)
so value 1431986400000l
min l
and max 1433109600000l
check numbers , adapt accordingly
Comments
Post a Comment