sliderV.addChangeListener( this );
There may be several sliders in your user interface.
They all generate change events.
If one change listener listens to all these events it is
convenient to give the sliders names so that the events
can be sorted out correctly.
(Another way is to register its own listener with each slider).
A name is a string that can be assigned to
any object that inherits from class Component
.
Assign it using:
component.setName( String name )
Of course you must make sure that components that share the same listener have unique names.
Assign names to the two sliders.
sliderA = new JSlider( SwingConstants.HORIZONTAL, 0, 1000, 400); sliderB = new JSlider( SwingConstants.HORIZONTAL, 0, 1000, 400); . . . sliderA.setName( ______ ); sliderb.setName( ______ ); sliderA.addChangeListener( this ); sliderB.addChangeListener( this );