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

public class GestionSouris implements MouseListener {

	private Component component;
	private GFenetre gfenetre;

	public GestionSouris(Component component, GFenetre gfenetre) {
		this.component = component;
		this.gfenetre = gfenetre;

	}

	@Override
	public void mouseClicked(MouseEvent e) {
		int x = e.getX();
		int width = component.getWidth();

		if(x < width / 2) {
			//Click à gauche de l'écran
			System.out.println("click gauche");
			this.gfenetre.change(0);
		} else {
			//Click à droite de l'écran
			System.out.println("Click droit");
			this.gfenetre.change(1);
		}
	}

	public void mousePressed(MouseEvent e) {}
    public void mouseReleased(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}
}