To get around this, I took my own copy of JSpinner, but this failed with
UIDefaults.getUI() failed: no ComponentUI class for: sun.com.JSpinner[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=]
java.lang.Error at javax.swing.UIDefaults.getUIError(Unknown Source)
Would the solution be to monitor the contents of the TextField and pre-convert the typing into the values in the list?
Grateful for any suggestions.
I wouldn't join any Collection with an add() method that would accept me as a parameter
Joined: Jun 09, 2003
in using that demo code, what are you trying to achieve?
if it's just a calendar, there are better (free) ones out there.
if you just want a month/year combo it's relatively simple to roll-your-own.
JSpinner, for dates/times, broke around java 1.4 and I don't know if it's ever been fixed.
The case? I suppose you have the months displayed like Jan and Oct? I have a year-and-month version of JSpinner which works just fine (although it's a bit un-intuitive), I use numeric months.
Edit: I tracked down the code, here's the important bits from the constructor:
Joined: Nov 09, 2008
Thanks Paul and Michael.
It was actually just SpinnerListModel, but formatting is what I needed (although it doesn't handle the general case where the list is coming from a source you don't have control over)
what are you trying to achieve?
Learning exercise. Am evaluating Spinners. That was just a simple example that showed a problem I was hitting elsewhere.
There is a second problem when the Object is something more complex than String.
As you type, it recognizes the entry, but on loss of focus the Spinner flips back to the previously selected value. System.out.println shows my Object's toString() method is returning the value that matches what I typed, so it should work?
On the topic of calendars and date-pickers, I'd be interested in your recommendations.