Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSpinner question  RSS feed

 
Matt Fyffe
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • 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.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!