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

JSlider ChangeEvent problem  RSS feed

 
Lorenzo Levrini
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSlider with 3 ticks on it. (See attached image)

It starts at the right and I move it all the way to the left. The changeEvents are triggered in the desired manner. But when I grab it from the left to the middle it triggers a ChangeEvent with source.getValue()=leftTick before it triggers the desired ChangeEvent with source.getValue()=middleTick. Surely moving it one tick across should just trigger a single change event with source.getValue()=middleTick? This makes no sense to me. Why is it doing this and how do I fix it??

Cheers!

Screen shot 2010-03-09 at 11.34.56.png
[Thumbnail for Screen shot 2010-03-09 at 11.34.56.png]
 
Lorenzo Levrini
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fixed this by adding an if statement that checks that the slider is not already at leftTick before responding to a leftTick ChangeEvent. I still think it's silly for the ChangeEvent to be triggered in this manner!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!