0

Basically this is the problem, I pull some data set from the database, and populate combobox with it.

So like you can see in this shoot http://prntscr.com/7bscob. Min and max jspinner values SHOULD depend on comboBox selected item.

So what I've tried to do is to set a minimal value dynamically, but it sends an IllegalArgumentException at the line where I 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));
                }       
            }
double-beep
  • 5,031
  • 17
  • 33
  • 41
kiselitza
  • 119
  • 8
  • Please add the full stack trace of the exception – Dragondraikk Jun 01 '15 at 08:48
  • Thank you for making me read it once again !!! :D I will update question with call stack so that everyone can pay atention on that, my default data (first value) was before my min value, thats why an exception was thrown – kiselitza Jun 01 '15 at 08:57

1 Answers1

1

Looks like the long l = turniri.get(i).getDatumPocetka().getTime() is somehow incorrect.

According to the error value in the SpinnerDateModel must be between min and max.

new SpinnerDateModel(new Date(1431986400000L), new Date(l), new Date(1433109600000L), Calendar.DAY_OF_YEAR)

So your value is 1431986400000L

Min is l

and max is 1433109600000L

CHeck the numbers and adapt accordingly

StanislavL
  • 56,971
  • 9
  • 68
  • 98