Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2 JSpinners with SpinnerModels

 
Peter Dennis
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have the following code:



However when I build my app and then go to the screen the spinDateEnteredFrom is 2 weeks ago (28/12/2008) but the top arrow on the spinner is greyed out as though the date for two weeks ago is the max date rather than today (11/01/2009).

spinDateEnteredTo also has its top arrow greyed out but that is what I want as the user shouldn't be able to search for anything beyond today's date.

Can someone please tell me how I can set the maximum allowable date for both JSpinners to be the current date?

I have attached an image of the above problem as well with both up arrows greyed out.

Thank you for any suggestions.

Peter.
Screenshot.png
[Thumbnail for Screenshot.png]
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Dennis wrote:

You've specified MONTH to be the change when you press up / down, so if you press up it would add one month, leading to 28-01-2009 which is beyond the maximum value. So that's why you can't have a later date.

If you want separate days you need to use days as the calendar field.
 
Peter Dennis
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:
Peter Dennis wrote:

You've specified MONTH to be the change when you press up / down, so if you press up it would add one month, leading to 28-01-2009 which is beyond the maximum value. So that's why you can't have a later date.

If you want separate days you need to use days as the calendar field.


Thank you so much Rob for the quick response! Awesome!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic