clear CreateLevelMenu2 and all object useless in Controller
This commit is contained in:
parent
09c4e87534
commit
89a6b09ea9
@ -19,100 +19,19 @@ import javafx.stage.Stage;
|
|||||||
|
|
||||||
public class Controller extends Application {
|
public class Controller extends Application {
|
||||||
private Stage stage;
|
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) {
|
public void start(Stage primaryStage) {
|
||||||
//set up the page
|
//set up the page
|
||||||
stage = primaryStage;
|
stage = primaryStage;
|
||||||
stage.setTitle("ROAD TO MASTER YOU");
|
stage.setTitle("ROAD TO MASTER YOU");
|
||||||
|
|
||||||
Level_menu = createLevel_menu();
|
stage.setScene(MenuAcceuil);
|
||||||
Level_menu2 = createLevel_Menu2();
|
|
||||||
|
|
||||||
stage.setScene(Menu);
|
|
||||||
stage.show();
|
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){
|
public void switchScenes(Scene scene){
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
|
|
||||||
|
@ -20,10 +20,8 @@ public class MenuLevelDay1 extends GridPane {
|
|||||||
super();
|
super();
|
||||||
GdP = new GridPane();
|
GdP = new GridPane();
|
||||||
//add all the button for level
|
//add all the button for level
|
||||||
for (Button c : Level_button) {
|
for (Button c : Level_button)
|
||||||
c = new Button();
|
c = new Button();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Level_button[0] = new Button("1");
|
Level_button[0] = new Button("1");
|
||||||
Level_button[1] = new Button("2");
|
Level_button[1] = new Button("2");
|
||||||
@ -55,6 +53,7 @@ public class MenuLevelDay1 extends GridPane {
|
|||||||
|
|
||||||
for( int i= 0;i<=9;i++);
|
for( int i= 0;i<=9;i++);
|
||||||
GridPane.setHalignment((Level_button[i],HPos.CENTER));;
|
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[10], HPos.LEFT);
|
||||||
GridPane.setHalignment(Level_button[11], HPos.RIGHT);
|
GridPane.setHalignment(Level_button[11], HPos.RIGHT);
|
||||||
|
Loading…
Reference in New Issue
Block a user