Forums Register Login

Multiple sliders with a single listener - can it be done?

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
You can try the getSource() method if your Event has such a method.

But it sounds like a peculiar design to me.
+Pie Number of slices to send: Send
Ok. I knew you could identify buttons, wasn't sure if sliders worked the same, apparently not. I'll just create multiple listeners.
+Pie Number of slices to send: Send
The getSource() method appears to be inherited from EventObject, so you can probably find it.

But I suspect separate Listeners is a better solution.
Squanch that. And squanch this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1975 times.
Similar Threads
How to Read a Queue Message from MDB
ServletContextAttribute Listener doubt
Hiding images bound to sliders
Designing with exception handling
Your GWT wish list
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 08:18:23.