Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSpinner Problem

 
Dennis Putnam
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following JSpinner:

I am using this for a time duration rather than a date/time so I only care about hours and minutes. The JSpinner is doing what I want with one exception. When the spinner is displayed, I can use the arrow to increase/decrease the hours. However, I cannot use the arrows to increase/decrease the minutes. I can highlight either the hours or minutes, but with minutes highlighted, when I click an arrow, it reverts to hours and changes it instead. I can manually type the minutes but that is all. I am guessing this has something to do with the editor but I am hoping it is a simple fix rather than me needing to write my own editor. TIA.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
worked fine for me, hours +/- OK, minutes (when highlighted) also +/- OK (java 6, win 7)
 
Guillaume Jourdan
Ranch Hand
Posts: 47
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I don't know if this is really a problem, but why you use with SimpleDateFormat the time pattern "h:m"
and with the DateEditor the time pattern "h:mm"

Can you test with :

 
Dennis Putnam
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:worked fine for me, hours +/- OK, minutes (when highlighted) also +/- OK (java 6, win 7)

This is bizarre. Now it works for me too? There was a Win 7 update that required a reboot but that is the only "event" I know about and none of the updates had anything to do with Java. Perhaps just the reboot did something. Sorry for the bother.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic