Clear the method CreateMenu to make a new class with the same role

This commit is contained in:
Mat
2023-04-30 13:07:36 +02:00
parent 24a7a73f36
commit 02b4ab8a35
3 changed files with 53 additions and 24 deletions

View File

@ -64,7 +64,7 @@ public class Controller extends Application {
//set up the page
stage = primaryStage;
stage.setTitle("ROAD TO MASTER YOU");
Menu = createMenu();
Level_menu = createLevel_menu();
Level_menu2 = createLevel_Menu2();
@ -72,25 +72,7 @@ public class Controller extends Application {
stage.show();
}
private Scene createMenu(){
Play = new Button("Play");
Trophy = new Button("Trophy");
Select_level = new Button("Select Level");
Select_level.setOnAction(event -> switchScenes(Level_menu));
title = new Label("Welcome to road to master you");
title.setFont(Font.font(20));
title.setTextFill(Color.GOLD);
BdP = new BorderPane(null,title,Select_level,Trophy,Play);
Menu = new Scene(BdP,700,400);
BorderPane.setAlignment(title,Pos.CENTER);
BorderPane.setAlignment(Play,Pos.CENTER);
BorderPane.setAlignment(Select_level,Pos.CENTER);
BorderPane.setAlignment(Trophy,Pos.CENTER);
//Menu.getStylesheets().add("style.css"); todo creat a file css
BdP.setPadding(new Insets(20,60,20,60));
return Menu;
}
private Scene createLevel_menu(){
bck_menu = new Button("Back to the menu");
bck_menu.setOnAction(event -> switchScenes(Menu));