SAE21_2021/SettingsListener.java

20 lines
615 B
Java
Raw Normal View History

2022-05-21 17:03:31 +02:00
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class SettingsListener implements ChangeListener{
private int settingToSet;
private int settingValue;
private FrameMenu menu;
public SettingsListener(int settingToSet, FrameMenu menu){
this.settingToSet=settingToSet;
this.menu=menu;
}
public void stateChanged(ChangeEvent evenement) {
JSlider slider = (JSlider) evenement.getSource();
settingValue=slider.getValue();
this.menu.setSettings(this.settingToSet, settingValue);
}
}