aspose file tools*
The moose likes Beginning Java and the fly likes 2 JSpinners with SpinnerModels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "2 JSpinners with SpinnerModels" Watch "2 JSpinners with SpinnerModels" New topic
Author

2 JSpinners with SpinnerModels

Peter Dennis
Greenhorn

Joined: Nov 30, 2008
Posts: 12
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.


[Thumbnail for Screenshot.png]

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19723
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Peter Dennis
Greenhorn

Joined: Nov 30, 2008
Posts: 12
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!
 
Don't get me started about those stupid light bulbs.
 
subject: 2 JSpinners with SpinnerModels