ajout bouton save
This commit is contained in:
parent
f8e68436b0
commit
14e046f4dd
BIN
Avancee.odt
BIN
Avancee.odt
Binary file not shown.
@ -14,13 +14,19 @@ public class Banniere extends JPanel {
|
||||
// On défini un style à la bannière
|
||||
this.setBackground(new Color(0, 236, 96));
|
||||
|
||||
// TODO : Bouton sauver et quitter
|
||||
// Bouton pour sauver et quitter
|
||||
JButton save = new JButton("Sauver et quitter");
|
||||
//save.addActionListener(new SaveListener());
|
||||
this.add(save, BorderLayout.EAST);
|
||||
System.out.println(save.getLocation());
|
||||
}
|
||||
|
||||
// Méthode pour afficher le nombre de mines restantes
|
||||
public void setMinesLeft(int minesLeft) {
|
||||
this.removeAll();
|
||||
this.add(new JLabel("Mines restantes : "+Integer.toString(minesLeft)),BorderLayout.CENTER);
|
||||
JLabel mines = new JLabel("Mines restantes : "+Integer.toString(minesLeft));
|
||||
Dimension prefSize = new Dimension(this.getWidth()/2,this.getHeight()/5);
|
||||
mines.setPreferredSize(prefSize);
|
||||
this.add(mines,BorderLayout.NORTH);
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
@ -28,8 +34,9 @@ public class Banniere extends JPanel {
|
||||
public void setVictoire() {
|
||||
JLabel victoire = new JLabel("Victoire ! Retour au menu...");
|
||||
victoire.setForeground(new Color(0, 22, 236));
|
||||
this.add(victoire,BorderLayout.SOUTH);
|
||||
Timer timerMenu = new Timer(5000, new MenuListener(this.fenetre, this.menu));
|
||||
victoire.setFont(new Font("Arial", Font.PLAIN, 30));
|
||||
this.add(victoire,BorderLayout.CENTER);
|
||||
Timer timerMenu = new Timer(7000, new MenuListener(this.fenetre, this.menu));
|
||||
timerMenu.setRepeats(false);
|
||||
timerMenu.start();
|
||||
}
|
||||
@ -38,8 +45,9 @@ public class Banniere extends JPanel {
|
||||
public void setDefaite() {
|
||||
JLabel defaite = new JLabel("Défaite ! Retour au menu...");
|
||||
defaite.setForeground(new Color(0, 22, 236));
|
||||
this.add(defaite,BorderLayout.SOUTH);
|
||||
Timer timerMenu = new Timer(5000, new MenuListener(this.fenetre, this.menu));
|
||||
defaite.setFont(new Font("Arial", Font.PLAIN, 30));
|
||||
this.add(defaite,BorderLayout.CENTER);
|
||||
Timer timerMenu = new Timer(7000, new MenuListener(this.fenetre, this.menu));
|
||||
timerMenu.setRepeats(false);
|
||||
timerMenu.start();
|
||||
}
|
||||
|
21
Fin.java
21
Fin.java
@ -1,21 +0,0 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.*;
|
||||
|
||||
public class Fin extends JComponent {
|
||||
private String message;
|
||||
private Dimension banniereSize;
|
||||
public Fin(String message, Dimension banniereSize) {
|
||||
super();
|
||||
this.message = message;
|
||||
this.banniereSize=banniereSize;
|
||||
}
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau) {
|
||||
this.setSize(banniereSize);
|
||||
Graphics chiffre = pinceau.create();
|
||||
Font font = new Font("Arial", Font.BOLD, banniereSize.width/50);
|
||||
chiffre.setFont(font);
|
||||
chiffre.setColor(new Color(0, 22, 236));
|
||||
chiffre.drawString(message,banniereSize.width/100,banniereSize.height*2/3);
|
||||
}
|
||||
}
|
5
Makefile
5
Makefile
@ -26,15 +26,12 @@ FrameJeu.class : FrameJeu.java Grille.class
|
||||
Grille.class : Grille.java Banniere.class Case.class
|
||||
${JC} ${JCFLAGS} Grille.java
|
||||
|
||||
Banniere.class : Banniere.java MenuListener.class Fin.class
|
||||
Banniere.class : Banniere.java MenuListener.class
|
||||
${JC} ${JCFLAGS} Banniere.java
|
||||
|
||||
Case.class : Case.java ListenerCase.class Entourage.class
|
||||
${JC} ${JCFLAGS} Case.java
|
||||
|
||||
Fin.class : Fin.java
|
||||
${JC} ${JCFLAGS} Fin.java
|
||||
|
||||
MenuListener.class : MenuListener.java
|
||||
${JC} ${JCFLAGS} MenuListener.java
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user