public class Affichage { public static final int COULOIR=0; public static final int MUR=1; public static final int ENTREE=2; public static final int SORTIE=3; public static final boolean LIBRE = true; public static final boolean OCCUPE = false; private Cellules cetteCellules; private PanneauModification cePanel; private boolean cetEtat; private int[] caseEntrortie; public Affichage(Cellules uneCellules, PanneauModification unPanel, int[] tabEntre, boolean unEtat){ this.cetteCellules = uneCellules; this.cePanel = unPanel; this.cetEtat = unEtat; this.caseEntrortie = tabEntre; repaint(); } public int[] getGateState(){ return this.caseEntrortie; } public void repaint(){ // Accéder aux boutons radios de l'objet Options boolean radio1Selected = this.cePanel.GetButtonBW().isSelected(); // MUR / COULOIR boolean radio2Selected = this.cePanel.GetButtonE().isSelected(); // ENTREE boolean radio3Selected = this.cePanel.GetButtonS().isSelected(); //SORTIE if(radio2Selected==true && this.caseEntrortie[0]==0){ if(this.caseEntrortie[0]==1){ this.caseEntrortie[0]=0; } else if(this.caseEntrortie[1]==1){ this.caseEntrortie[1]=0; } this.caseEntrortie[0]=1; this.cetteCellules.setType(ENTREE); this.cetteCellules.peindre(ENTREE); } else if(radio3Selected==true && this.caseEntrortie[1]==0){ if(this.caseEntrortie[0]==1){ this.caseEntrortie[0]=0; } else if(this.caseEntrortie[1]==1){ this.caseEntrortie[1]=0; } this.caseEntrortie[1]=1; this.cetteCellules.setType(SORTIE); this.cetteCellules.peindre(SORTIE); } else if(radio1Selected==true && this.cetEtat==true){ if(this.caseEntrortie[0]==1){ this.caseEntrortie[0]=0; } else if(this.caseEntrortie[1]==1){ this.caseEntrortie[1]=0; } this.cetteCellules.setType(COULOIR); this.cetteCellules.peindre(COULOIR); } else if(radio1Selected==true && this.cetEtat==OCCUPE){ if(this.caseEntrortie[0]==1){ this.caseEntrortie[0]=0; } else if(this.caseEntrortie[1]==1){ this.caseEntrortie[1]=0; } this.cetteCellules.setType(MUR); this.cetteCellules.peindre(MUR); } } }