fenêtre de jeu centrée
This commit is contained in:
parent
46b6dead29
commit
fee7f5d7a2
@ -10,36 +10,33 @@ public class FrameJeu{
|
|||||||
|
|
||||||
// On crée ensuite notre fenêtre avec des valeurs par défaut
|
// On crée ensuite notre fenêtre avec des valeurs par défaut
|
||||||
JFrame fenetre = new JFrame("Démineur - En Jeu");
|
JFrame fenetre = new JFrame("Démineur - En Jeu");
|
||||||
fenetre.setSize(screenSize.width * 2/3,screenSize.height * 2/3);
|
|
||||||
fenetre.setLocation(screenSize.width * 1/6, screenSize.height * 1/6);
|
|
||||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// En test
|
// En test
|
||||||
|
|
||||||
Color rose = new Color(236,0,140);
|
Color rose = new Color(236,0,140);
|
||||||
|
Color vert = new Color(0, 236, 96);
|
||||||
|
|
||||||
Dimension grilleSize= grille.getGrilleSize();
|
Dimension grilleSize= grille.getGrilleSize();
|
||||||
JPanel banniere= new JPanel();
|
JPanel banniere= new JPanel();
|
||||||
banniere.setBackground(rose);
|
banniere.setBackground(vert);
|
||||||
Dimension banniereSize=new Dimension(grilleSize.width,grilleSize.height/9);
|
Dimension banniereSize=new Dimension(grilleSize.width,grilleSize.height/10);
|
||||||
banniere.setSize(banniereSize);
|
banniere.setSize(banniereSize);
|
||||||
|
|
||||||
banniere.setBounds( 0, 0, banniereSize.width, banniereSize.height);
|
//banniere.setBounds( 0, 0, banniereSize.width, banniereSize.height);
|
||||||
JPanel plateau=grille.getGrille();
|
JPanel plateau=grille.getGrille();
|
||||||
plateau.setBounds( 0, banniereSize.height, grilleSize.width,grilleSize.height);
|
//plateau.setBounds( 0, banniereSize.height, grilleSize.width,grilleSize.height);
|
||||||
|
|
||||||
fenetre.add(banniere);
|
fenetre.add(banniere);
|
||||||
fenetre.add(plateau);
|
fenetre.add(plateau);
|
||||||
|
fenetre.pack();
|
||||||
|
Dimension fenetreSize=fenetre.getSize();
|
||||||
System.out.println("Taille bannière : "+banniereSize);
|
fenetre.setLocation(screenSize.width/2-(fenetreSize.width/2), screenSize.height/2-(fenetreSize.height/2));
|
||||||
System.out.println("Taille grille : "+grilleSize);
|
//fenetre.setLayout(null);
|
||||||
System.out.println("Taille écran : "+screenSize);
|
|
||||||
|
|
||||||
fenetre.setLayout(null);
|
|
||||||
fenetre.setVisible(true);
|
fenetre.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
BIN
etoile.png
Normal file
BIN
etoile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Loading…
Reference in New Issue
Block a user