I have two JSliders that are both going to a common stateChanged Method, but I am having trouble separating them. I assumes they were somewhat like separating something in the actionPerformed method, but it doesn't seem to work. it does however go into the method, it is just the if statements that are not working.
public void stateChanged(ChangeEvent e) {
// TODO Auto-generated method stub
JSlider source = (JSlider)e.getSource();
if ("waveSlider1".equals(source)){
waveLength1 = (int)source.getValue();
System.out.print("Value Changed to: " + waveLength1);
}
if ("waveSlider2".equals(source)){
waveLength2 = (int)source.getValue();
System.out.print("Value Changed to: " + waveLength2);
}
System.out.print("Senses Change");
}