• 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 question

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey, I am working on a program that really doesnt do anything. But I was trying to utilize JSpinners using the SpinnerNumberModel. Here's what I am trying to have work. If I have two JSpinners, and I click to change the value on one of them, how can I find out whether it went up or down so I can change the other Spinner in the opposite direction? Is there a way I can check the number that was previously shown on the spinner, or at least get the source of whether the up or down arrow was clicked?
Thanks a lot, and if this was supposed to be in another forum... my apologies.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would say just get the value and do a < > comparison. If is is < you went down, > up.
 
Matt Fyffe
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yea, I was thinking about using that... Would it be safe for me to assume that ChangeListener would work roughly the same as ActionListener?
 
Matt Fyffe
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I use getValue() to see the number, it makes me save this value as an object. How can I read it in as an int to compare it to the previous value? I tried storing it as an int but it said they were incompatible types.
[ July 02, 2003: Message edited by: Matt Fyffe ]
 
Matt Fyffe
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry to bump this old topic but these JSpinners haven't stopped driving me nuts. How do i read and write to the JSpinner? I tried getValue but that returns an object which I haven't been able to successfully convert to an integer yet. With setValue its the opposite. I have an integer but how can I convert it to an acceptable object? Thanks. Note: This is using SpinnerNumberModel.
 
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic