From 89a6b09ea94e72d21ec777e02f1b376546363c85 Mon Sep 17 00:00:00 2001 From: Mat Date: Sun, 30 Apr 2023 13:50:44 +0200 Subject: [PATCH] clear CreateLevelMenu2 and all object useless in Controller --- .../main/java/school_project/Controller.java | 85 +------------------ .../java/school_project/MenuLevelDay1.java | 5 +- 2 files changed, 4 insertions(+), 86 deletions(-) diff --git a/app/src/main/java/school_project/Controller.java b/app/src/main/java/school_project/Controller.java index 1f8ad98..0eb92d9 100644 --- a/app/src/main/java/school_project/Controller.java +++ b/app/src/main/java/school_project/Controller.java @@ -19,100 +19,19 @@ import javafx.stage.Stage; public class Controller extends Application { private Stage stage; - //set up scene one - //set up scene 2 - private Scene Level_menu; - - //set up scene 3 - private Scene Level_menu2; - private GridPane GdP2; - private Button _11; - private Button _12; - private Button _13; - private Button _14; - private Button _15; - private Button _16; - private Button _17; - private Button _18; - private Button _19; - private Button _20; - - //button for level - private Button Day_1; - private Button Day_2; - private Button Day_3; public void start(Stage primaryStage) { //set up the page stage = primaryStage; stage.setTitle("ROAD TO MASTER YOU"); - - Level_menu = createLevel_menu(); - Level_menu2 = createLevel_Menu2(); - - stage.setScene(Menu); + + stage.setScene(MenuAcceuil); stage.show(); } - private Scene createLevel_Menu2(){ - bck_menu = new Button("Back to menu"); - bck_menu.setOnAction(event -> switchScenes(Menu)); - GdP2 = new GridPane(); - - //set up the menubutton - Day_1 = new Button("Day 1"); - Day_3 = new Button("Day 3"); - //set up link - Day_1.setOnAction(event -> switchScenes(Level_menu)); - //add all the button for the level - GdP2.add(Day_1,1,0); - GdP2.add(Day_3,1,0); - _11 = new Button("11"); - _12 = new Button("12"); - _13 = new Button("13"); - _14 = new Button("14"); - _15 = new Button("15"); - _16 = new Button("16"); - _17 = new Button("17"); - _18 = new Button("18"); - _19 = new Button("19"); - _20 = new Button("20"); - Day_1 = new Button("Day 1"); - Day_3 = new Button("Day 3"); - - GdP2.add(_11,0,1); - GdP2.add(_12,1,1); - GdP2.add(_13,2,1); - GdP2.add(_14,0,2); - GdP2.add(_15,1,2); - GdP2.add(_16,2,2); - GdP2.add(_17,0,3); - GdP2.add(_18,1,3); - GdP2.add(_19,2,3); - GdP2.add(_20,1,4); - GdP2.add(bck_menu,2,4); - GridPane.setHalignment(_11, HPos.CENTER); - GridPane.setHalignment(_12, HPos.CENTER); - GridPane.setHalignment(_13, HPos.CENTER); - GridPane.setHalignment(_14, HPos.CENTER); - GridPane.setHalignment(_15, HPos.CENTER); - GridPane.setHalignment(_16, HPos.CENTER); - GridPane.setHalignment(_17, HPos.CENTER); - GridPane.setHalignment(_18, HPos.CENTER); - GridPane.setHalignment(_19, HPos.CENTER); - GridPane.setHalignment(_20, HPos.CENTER); - GridPane.setHalignment(Day_1, HPos.LEFT); - GridPane.setHalignment(Day_3, HPos.RIGHT); - GridPane.setHalignment(bck_menu, HPos.CENTER); - - return Level_menu2; - - - - } public void switchScenes(Scene scene){ stage.setScene(scene); diff --git a/app/src/main/java/school_project/MenuLevelDay1.java b/app/src/main/java/school_project/MenuLevelDay1.java index cb111bf..1a08e80 100644 --- a/app/src/main/java/school_project/MenuLevelDay1.java +++ b/app/src/main/java/school_project/MenuLevelDay1.java @@ -20,10 +20,8 @@ public class MenuLevelDay1 extends GridPane { super(); GdP = new GridPane(); //add all the button for level - for (Button c : Level_button) { + for (Button c : Level_button) c = new Button(); - } - Level_button[0] = new Button("1"); Level_button[1] = new Button("2"); @@ -55,6 +53,7 @@ public class MenuLevelDay1 extends GridPane { for( int i= 0;i<=9;i++); GridPane.setHalignment((Level_button[i],HPos.CENTER));; + //todo understand why it doesn't work GridPane.setHalignment(Level_button[10], HPos.LEFT); GridPane.setHalignment(Level_button[11], HPos.RIGHT);