Clear CreateLevel1 to make a new class
This commit is contained in:
		@ -20,17 +20,10 @@ 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 one
 | 
				
			||||||
    private Scene Menu;
 | 
					 | 
				
			||||||
    private BorderPane BdP;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Label title;
 | 
					 | 
				
			||||||
    private Button Play;
 | 
					 | 
				
			||||||
    private Button Select_level;
 | 
					 | 
				
			||||||
    private Button Trophy;
 | 
					 | 
				
			||||||
    //set up scene 2
 | 
					    //set up scene 2
 | 
				
			||||||
    private Scene Level_menu;
 | 
					    private Scene Level_menu;
 | 
				
			||||||
    private GridPane GdP;
 | 
					
 | 
				
			||||||
    private Button bck_menu;
 | 
					 | 
				
			||||||
    //set up scene 3
 | 
					    //set up scene 3
 | 
				
			||||||
    private Scene Level_menu2;
 | 
					    private Scene Level_menu2;
 | 
				
			||||||
    private GridPane GdP2;
 | 
					    private GridPane GdP2;
 | 
				
			||||||
@ -49,16 +42,6 @@ public class Controller extends Application {
 | 
				
			|||||||
    private Button Day_1;
 | 
					    private Button Day_1;
 | 
				
			||||||
    private Button Day_2;
 | 
					    private Button Day_2;
 | 
				
			||||||
    private Button Day_3;
 | 
					    private Button Day_3;
 | 
				
			||||||
    private Button _1;
 | 
					 | 
				
			||||||
    private Button _2;
 | 
					 | 
				
			||||||
    private Button _3;
 | 
					 | 
				
			||||||
    private Button _4;
 | 
					 | 
				
			||||||
    private Button _5;
 | 
					 | 
				
			||||||
    private Button _6;
 | 
					 | 
				
			||||||
    private Button _7;
 | 
					 | 
				
			||||||
    private Button _8;
 | 
					 | 
				
			||||||
    private Button _9;
 | 
					 | 
				
			||||||
    private Button _10;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void start(Stage primaryStage) {
 | 
					    public void start(Stage primaryStage) {
 | 
				
			||||||
        //set up the page
 | 
					        //set up the page
 | 
				
			||||||
@ -73,37 +56,7 @@ public class Controller extends Application {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Scene createLevel_menu(){
 | 
					 | 
				
			||||||
        bck_menu = new Button("Back to the menu");
 | 
					 | 
				
			||||||
        bck_menu.setOnAction(event -> switchScenes(Menu));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ColumnConstraints col_1 = new ColumnConstraints();
 | 
					 | 
				
			||||||
        col_1.setPercentWidth(33);
 | 
					 | 
				
			||||||
        ColumnConstraints col_2 = new ColumnConstraints();
 | 
					 | 
				
			||||||
        col_2.setPercentWidth(33);
 | 
					 | 
				
			||||||
        ColumnConstraints col_3 = new ColumnConstraints();
 | 
					 | 
				
			||||||
        col_3.setPercentWidth(34);
 | 
					 | 
				
			||||||
        GdP.getColumnConstraints().addAll(col_1,col_2,col_3);
 | 
					 | 
				
			||||||
        //GdP.setGridLinesVisible(true);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(_1, HPos.CENTER);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(_2, HPos.CENTER);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(_3, HPos.CENTER);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(_4, HPos.CENTER);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(_5, HPos.CENTER);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(_6, HPos.CENTER);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(_7, HPos.CENTER);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(_8, HPos.CENTER);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(_9, HPos.CENTER);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(_10, HPos.CENTER);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(Day_2, HPos.LEFT);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(Day_3, HPos.RIGHT);
 | 
					 | 
				
			||||||
        GridPane.setHalignment(bck_menu, HPos.CENTER);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Day_2.setOnAction(event -> switchScenes(Level_menu2));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return Level_menu;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    private Scene createLevel_Menu2(){
 | 
					    private Scene createLevel_Menu2(){
 | 
				
			||||||
        bck_menu = new Button("Back to menu");
 | 
					        bck_menu = new Button("Back to menu");
 | 
				
			||||||
        bck_menu.setOnAction(event -> switchScenes(Menu));
 | 
					        bck_menu.setOnAction(event -> switchScenes(Menu));
 | 
				
			||||||
 | 
				
			|||||||
@ -36,6 +36,7 @@ public class MenuAcceuil extends GridPane {
 | 
				
			|||||||
        BorderPane.setAlignment(Trophy,Pos.CENTER);
 | 
					        BorderPane.setAlignment(Trophy,Pos.CENTER);
 | 
				
			||||||
        //Menu.getStylesheets().add("style.css"); todo creat a file css
 | 
					        //Menu.getStylesheets().add("style.css"); todo creat a file css
 | 
				
			||||||
        BdP.setPadding(new Insets(20,60,20,60));
 | 
					        BdP.setPadding(new Insets(20,60,20,60));
 | 
				
			||||||
 | 
					        //need help to add MenuAcceuil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -20,6 +20,11 @@ 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) {
 | 
				
			||||||
 | 
					            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");
 | 
				
			||||||
        Level_button[2]= new Button("3");
 | 
					        Level_button[2]= new Button("3");
 | 
				
			||||||
@ -48,6 +53,20 @@ public class MenuLevelDay1 extends GridPane {
 | 
				
			|||||||
        GdP.add(Level_button[9],1,4);
 | 
					        GdP.add(Level_button[9],1,4);
 | 
				
			||||||
        GdP.add(Level_button[12],2,4);
 | 
					        GdP.add(Level_button[12],2,4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        for( int i= 0;i<=9;i++);
 | 
				
			||||||
 | 
					            GridPane.setHalignment((Level_button[i],HPos.CENTER));;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        GridPane.setHalignment(Level_button[10], HPos.LEFT);
 | 
				
			||||||
 | 
					        GridPane.setHalignment(Level_button[11], HPos.RIGHT);
 | 
				
			||||||
 | 
					        GridPane.setHalignment(Level_button[12], HPos.CENTER);
 | 
				
			||||||
 | 
					        ColumnConstraints col_1 = new ColumnConstraints();
 | 
				
			||||||
 | 
					        col_1.setPercentWidth(33);
 | 
				
			||||||
 | 
					        ColumnConstraints col_2 = new ColumnConstraints();
 | 
				
			||||||
 | 
					        col_2.setPercentWidth(33);
 | 
				
			||||||
 | 
					        ColumnConstraints col_3 = new ColumnConstraints();
 | 
				
			||||||
 | 
					        col_3.setPercentWidth(34);
 | 
				
			||||||
 | 
					        GdP.getColumnConstraints().addAll(col_1,col_2,col_3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user