pause midi

This commit is contained in:
Haïssous Kayyissa 2022-04-26 12:53:34 +02:00
parent 94c54d9b88
commit 7da3f45625
2 changed files with 13 additions and 20 deletions

View File

@ -9,12 +9,11 @@ public class FrameJeu{
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int frameWidth = screenSize.width * 2/3;
int frameHeight = screenSize.height * 2/3;
int frameLocation[]={screenSize.width * 1/6, screenSize.height * 1/6};
// On crée ensuite notre fenêtre
// On crée ensuite notre fenêtre avec des valeurs par défaut
JFrame fenetre = new JFrame("Démineur - En Jeu");
fenetre.setSize(frameWidth,frameHeight);
fenetre.setLocation(frameLocation[0],frameLocation[1]);
fenetre.setLocation(screenSize.width * 1/6, screenSize.height * 1/6);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@ -25,7 +24,6 @@ public class FrameJeu{
Dimension caseSize = new Dimension(frameWidth/colonnes,frameWidth/colonnes);
GridLayout damier = new GridLayout(lignes,colonnes);
fenetre.setLayout(damier);
System.out.println(" Jeu " + damierSize.width +" "+ damierSize.height + " "+caseSize.width +" "+ caseSize.height );
// Création des couleurs
Color gray1 = new Color(80,80,80);
@ -37,27 +35,24 @@ public class FrameJeu{
if (currentLine%2==0){
if (currentCase%2==0){
JPanel dark = new JPanel();
dark.setPreferredSize(caseSize);
dark.setSize(caseSize);
dark.setBackground(gray2);
if ((currentLine==0)&&(currentCase==8)){
System.out.println("ok");
}
fenetre.add(dark);
} else {
JPanel light = new JPanel();
light.setPreferredSize(caseSize);
light.setSize(caseSize);
light.setBackground(gray1);
fenetre.add(light);
}
} else {
if (currentCase%2==0){
JPanel light = new JPanel();
light.setPreferredSize(caseSize);
light.setSize(caseSize);
light.setBackground(gray1);
fenetre.add(light);
} else {
JPanel dark = new JPanel();
dark.setPreferredSize(caseSize);
dark.setSize(caseSize);
dark.setBackground(gray2);
fenetre.add(dark);
}
@ -65,7 +60,8 @@ public class FrameJeu{
}
}
fenetre.pack();
System.out.println(" Jeu " + fenetre.getSize() + " "+caseSize.width +" "+ caseSize.height );
fenetre.setLocation(damierSize.width * 1/6,(screenSize.height/2)- frameHeight/2);
fenetre.setVisible(true);
System.out.println(" Jeu " + damierSize.width * 1/6 +" "+ ((screenSize.height/2)- frameHeight/2) + " "+caseSize.width +" "+ caseSize.height );
}
}

View File

@ -22,25 +22,22 @@ public class FrameMenu{
// Découpage de la fenêtre pour la mise en place du damier
Dimension damierSize = fenetre.getSize();
Dimension caseSize = new Dimension(damierSize.width/75, damierSize.height/75);
GridLayout damier = new GridLayout(caseSize.height, caseSize.width);
Dimension gridSize = new Dimension(damierSize.width/75, damierSize.height/75);
GridLayout damier = new GridLayout(gridSize.height, gridSize.width);
fenetre.setLayout(damier);
System.out.println(" Menu " + damierSize.width +" "+ damierSize.height + " "+caseSize.width +" "+ caseSize.height );
System.out.println(" Menu " + damierSize.width +" "+ damierSize.height + " "+gridSize.width +" "+ gridSize.height );
// Création des couleurs
Color gray1 = new Color(80,80,80);
Color gray2 = new Color(70,70,70);
// Réalisation du damier et ajout d'éléments graphiques
for (int line=0; line<caseSize.height; line++){
for(int cases = 0; cases < caseSize.width; cases++){
for (int line=0; line<gridSize.height; line++){
for(int cases = 0; cases < gridSize.width; cases++){
if (line%2==0){
if (cases%2==0){
JPanel dark = new JPanel();
dark.setBackground(gray2);
if ((line==0)&&(cases==8)){
System.out.println("ok");
}
fenetre.add(dark);
} else {
JPanel light = new JPanel();