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 49 50 51 52 53 54 55 56
|
public class Interface extends JFrame {
/*
* Declaration des Varibles
*/
private ImageIcon bottom = new ImageIcon("Dream.jpg");
/**
* Methode qui doit Fermer La fenetre
*/
private void disposer() {
this.dispose();
}
public Interface(String titre) {
super("Welcome");
this.setSize(600, 600);
this.setLocationRelativeTo(this.getParent());//centrer à L'écran
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
/*changer la ptite icone de La fenetre (faut donner une autre icone) */
Image icone = Toolkit.getDefaultToolkit().getImage("icon.gnp");
this.setIconImage(icone);
/*pour la fermeture de la fenetre */
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
JWindow win = new JWindow();
JLabel label = new JLabel("@bientot");
JPanel panel = new JPanel();
panel.add(label);
win.add(panel);
win.setVisible(true);
dispose();
}
});
//Pour l'arriere plan de La fenetre
JLabel img = new JLabel();
img.setVerticalAlignment(JLabel.CENTER);
img.setHorizontalAlignment(JLabel.CENTER);
img.setIcon(bottom);
jeu.setBorder(BorderFactory.createLineBorder(Color.blue));
} |
Partager