Affichage des boutons pour les levels ok

This commit is contained in:
Mat 2023-05-01 20:07:44 +02:00
parent b4b89bcd86
commit dc5da4956a
2 changed files with 58 additions and 3 deletions

View File

@ -15,8 +15,6 @@ public class MenuAcceuil extends BorderPane {
private Button Play; private Button Play;
public static Button SelectLevel; public static Button SelectLevel;
private Button Trophy; private Button Trophy;
private Scene scene;
private BorderPane BdP;
private Label Title; private Label Title;
@ -38,7 +36,7 @@ public class MenuAcceuil extends BorderPane {
setAlignment(Trophy,Pos.CENTER); setAlignment(Trophy,Pos.CENTER);
//Menu.getStylesheets().add("style.css"); todo creat a file css //Menu.getStylesheets().add("style.css"); todo creat a file css
setPadding(new Insets(20,60,20,60)); setPadding(new Insets(20,60,20,60));
//need help to add MenuAcceuil
} }

View File

@ -0,0 +1,57 @@
package school_project.Menu;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;
public class MenuLevel extends GridPane {
public Button BckMenu;
public Button[] Days = new Button[3];
public int StartLevel;
public MenuLevel(int choose_day) {
BckMenu = new Button("Back to menu");
for (int i = 0; i < Days.length; i++) {
int a = 1;
Days[i] = new Button(Integer.toString(a));
a += 1;
}
if (choose_day == 1)
StartLevel = 1;
if (choose_day == 2)
StartLevel = 11;
if (choose_day == 3)
StartLevel = 21;
GridPane GdP = new GridPane();
for (int i = 0; i < 3; i++) {
if (i == 1)
StartLevel=2;
else if (i ==2)
StartLevel=3;
for (int j = 0; j < 4; j++) {
if(i==0){
Button Level = new Button(Integer.toString(StartLevel));
StartLevel+=3;
GdP.add(Level,i,j);
}
else if(i==1&&j!=3){
Button Level = new Button(Integer.toString(StartLevel));
StartLevel+=3;
GdP.add(Level,i,j);
}
else if(i==2&&j!=3){
Button Level = new Button(Integer.toString(StartLevel));
StartLevel+=3;
GdP.add(Level,i,j);
}
}
}
getChildren().addAll(GdP);
}
}