1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| public final class Score extends JDialog{
private Interface_Boggle ib= new Interface_Boggle();
private JLabel score;
private JLabel texte;
private ArrayList<JLabel> mots = new ArrayList<JLabel>();
private Bouton_Boggle quitter = new Bouton_Boggle("Quitter");
public Score(int score, ArrayList<String> mots){
GraphicsDevice myDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
this.setUndecorated(true);
this.setSize(250,120); //Taille
this.add(creerPanel(score ,mots)); //Ajout du panel (global)
this.setLocationRelativeTo(null);
this.setModal(true);
this.setResizable(false);
}
public JPanel creerPanel(int score, ArrayList<String> mots){
//String mot = null;
JPanel p = new JPanel();
p.setLayout(new BorderLayout(2,2));
p.setBorder( BorderFactory.createMatteBorder(
3, 3, 3, 3,
new Color(210, 180, 140)));
this.score = new JLabel("Vous avez un score final de : " + score + " points");
this.score.setHorizontalAlignment(JLabel.CENTER);
p.add(this.score, BorderLayout.CENTER);
quitter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
p.add(quitter, BorderLayout.SOUTH);
return p;
}
} |
Partager