• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSpinner text not updating

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JSpinner with a SpinnerDateModel on a screen that scrolls through various database records. First time through, the date shows up fine. When the database record changes, though, the text displayed doesn't change. This is what I'm doing:
In my constructor:


In a method triggered by my constructor and an actionlistener:


Thanks in advance for your help

ms
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're going to make a new SpinnerDateModel and new JSpinner for every call you'll have to remove the old spinner from your gui and add the new one in it's place. Changing the spinner that the reference (member variable) spnr points to has no affect on what your gui is using.

Since you are only changing the value in the SpinnerDateModel you could avoid the expense of making new components and adding/removing/validating by resetting your model. Call setValue(run.getRunTS()) on your SpinnerDateModel.
 
Mike Southgate
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow, that was pretty obvious once it was pointed out to me. Thanks, Craig, I'd spent several hours fighting with it and did try setValue, I just did it on the new spnr!

thanks again

ms
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic