import java.awt.event.*;
import java.awt.*;
import javax.swing.*;

public class MoletteSouris implements MouseWheelListener {

	private Fenetre fenetre;
	private Cercle[] tabCercles;
	private int depart;

	public MoletteSouris(Fenetre fenetre, Cercle[] tabCercles) {
		this.fenetre = fenetre;
		this.tabCercles = tabCercles;
		this.depart = 5;
	}

	@Override 
	public void mouseWheelMoved(MouseWheelEvent evenement) {
		int sensRotation = evenement.getWheelRotation();
		this.depart -= sensRotation;
		
		if (this.depart == 11) {
			this.depart = 10;
		}
		else if (this.depart == -1) {
			this.depart = 0;
		} 
		
		for (int i = 0; i < this.depart ; i++) {
			this.tabCercles[i].setFond(Color.ORANGE);
		}
		for (int i = this.depart; i < 10; i++) {
			this.tabCercles[i].setFond(Color.LIGHT_GRAY);
		}
		this.fenetre.repaint();

	}
}