2022-05-21 17:03:31 +02:00
|
|
|
import javax.swing.JSlider;
|
|
|
|
import javax.swing.event.ChangeEvent;
|
|
|
|
import javax.swing.event.ChangeListener;
|
|
|
|
|
2022-05-25 10:42:04 +02:00
|
|
|
/**
|
|
|
|
* La classe <code>SettingsListener</code> implémente l'interface ChangeListener
|
|
|
|
* et permet de connaître la valeur des paramètres
|
|
|
|
*
|
|
|
|
* @version 1.1
|
|
|
|
* @author Kayyissa Haïssous
|
|
|
|
*/
|
2022-05-21 17:03:31 +02:00
|
|
|
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;
|
|
|
|
}
|
2022-05-24 22:32:34 +02:00
|
|
|
|
2022-05-25 10:42:04 +02:00
|
|
|
/**
|
|
|
|
* Méthode qui doit être rédigée
|
|
|
|
* @param evenement l'évenement sur le JSlider
|
|
|
|
*/
|
2022-05-24 22:32:34 +02:00
|
|
|
@Override
|
2022-05-21 17:03:31 +02:00
|
|
|
public void stateChanged(ChangeEvent evenement) {
|
|
|
|
JSlider slider = (JSlider) evenement.getSource();
|
|
|
|
settingValue=slider.getValue();
|
|
|
|
this.menu.setSettings(this.settingToSet, settingValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|