JSlider jump on mouse click

Posted by Aly on Stack Overflow See other posts from Stack Overflow or by Aly
Published on 2010-03-08T16:04:27Z Indexed on 2010/03/08 16:21 UTC
Read the original article Hit count: 482

Filed under:
|
|
|
|

Hi,

I have a JSlider which shows bet sizes (for a poker game) I am trying to achieve the effect that when a mouse click occurs the slider jumps forward by a bet amount (i.e. a big blind amount) rather than just incrementing by one. If the mouse click happens to the left of the bar i want it to decrement by a fixed amount else increment. I looked into attaching a mouse listener, but do not know how I can use the event to find out on what side of the bar the mouse was clicked.

Any ideas?

© Stack Overflow or respective owner

Related posts about jslider

Related posts about swing