| Author |
Multiple sliders with a single listener - can it be done?
|
Mike Lipay
Ranch Hand
Joined: Sep 11, 2007
Posts: 171
|
|
|
Can I have more than one JSlider reporting to a single ChangeListener, and be able to tell which one is triggering the event? If so, how? I currently have three sliders on my window and they are reporting to the same listener, but I can't seem to find out how to tell which one is being moved.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
You can try the getSource() method if your Event has such a method.
But it sounds like a peculiar design to me.
|
 |
Mike Lipay
Ranch Hand
Joined: Sep 11, 2007
Posts: 171
|
|
|
Ok. I knew you could identify buttons, wasn't sure if sliders worked the same, apparently not. I'll just create multiple listeners.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
The getSource() method appears to be inherited from EventObject, so you can probably find it.
But I suspect separate Listeners is a better solution.
|
 |
 |
|
|
subject: Multiple sliders with a single listener - can it be done?
|
|
|