How to lock 3 JSliders together

T

TonyZ

Hi all,
I have 3 JSliders and I want the option of locking their movement
together. I use
a checkbox labeled "Lock Sliders" to determine whether the sliders
should be locked or not.

I thought I could do this by using the "setValue()" method on the two
sliders that were not
being draged. For example, if the user was dragging slider A, I would
set the value of B and C in the Change Listener routine.


The problem is that the setValue() fires a changed state for the B and
C sliders (each of
which, in turn, fires a changed state for the other two, causing a big
problem).


Anybody ever tried locking sliders? How can it be done?


Thanks,
Tony
 
A

Andrey Kuznetsov

I have 3 JSliders and I want the option of locking their movement
together. I use
a checkbox labeled "Lock Sliders" to determine whether the sliders
should be locked or not.

I thought I could do this by using the "setValue()" method on the two
sliders that were not
being draged. For example, if the user was dragging slider A, I would
set the value of B and C in the Change Listener routine.


The problem is that the setValue() fires a changed state for the B and
C sliders (each of
which, in turn, fires a changed state for the other two, causing a big
problem).

you may:
a) check current value and call setValue only if it is different.
or
b) use same model for all 3 sliders

Andrey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top