diff --git a/app/src/main/java/school_project/Controller.java b/app/src/main/java/school_project/Controller.java index 5635eba..cfa008e 100644 --- a/app/src/main/java/school_project/Controller.java +++ b/app/src/main/java/school_project/Controller.java @@ -4,27 +4,34 @@ import javafx.application.Application; import javafx.geometry.HPos; import javafx.geometry.Insets; import javafx.geometry.Pos; +import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; +import javafx.scene.control.Menu; import javafx.scene.layout.BorderPane; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.stage.Stage; - +import school_project.Menu.MenuAcceuil; +import school_project.Menu.MenuLevelDay1; +import school_project.Menu.MenuLevelDay2; public class Controller extends Application { private Stage stage; + Parent root; public void start(Stage primaryStage) { //set up the page + root = new MenuAcceuil(); stage = primaryStage; stage.setTitle("ROAD TO MASTER YOU"); + stage.setScene(new Scene(root)); stage.show(); } diff --git a/app/src/main/java/school_project/Menu/MenuAcceuil.java b/app/src/main/java/school_project/Menu/MenuAcceuil.java index c88c66a..e243179 100644 --- a/app/src/main/java/school_project/Menu/MenuAcceuil.java +++ b/app/src/main/java/school_project/Menu/MenuAcceuil.java @@ -11,9 +11,9 @@ import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.stage.Stage; -public class MenuAcceuil extends GridPane { +public class MenuAcceuil extends BorderPane { private Button Play; - private Button SelectLevel; + public static Button SelectLevel; private Button Trophy; private Scene scene; private BorderPane BdP; @@ -26,16 +26,18 @@ public class MenuAcceuil extends GridPane { SelectLevel= new Button("Select Level"); Trophy = new Button("Trophy"); Title = new Label("Welcome to Road to Master"); - BdP = new BorderPane(null,Title,SelectLevel,Trophy,Play); - scene = new Scene(BdP,700,400); + setTop(Title); + setLeft(Play); + setRight(SelectLevel); + setBottom(Trophy); Title.setFont(Font.font(20)); Title.setTextFill(Color.GOLD); - BorderPane.setAlignment(Title, Pos.CENTER); - BorderPane.setAlignment(Play,Pos.CENTER); - BorderPane.setAlignment(SelectLevel,Pos.CENTER); - BorderPane.setAlignment(Trophy,Pos.CENTER); + setAlignment(Title, Pos.CENTER); + setAlignment(Play,Pos.CENTER); + setAlignment(SelectLevel,Pos.CENTER); + setAlignment(Trophy,Pos.CENTER); //Menu.getStylesheets().add("style.css"); todo creat a file css - BdP.setPadding(new Insets(20,60,20,60)); + setPadding(new Insets(20,60,20,60)); //need help to add MenuAcceuil } diff --git a/app/src/main/java/school_project/Menu/MenuLevelDay1.java b/app/src/main/java/school_project/Menu/MenuLevelDay1.java index c5f69ed..fb06d8b 100644 --- a/app/src/main/java/school_project/Menu/MenuLevelDay1.java +++ b/app/src/main/java/school_project/Menu/MenuLevelDay1.java @@ -9,9 +9,12 @@ import javafx.scene.control.Button; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; +import java.util.HashMap; +import java.util.Map; + public class MenuLevelDay1 extends GridPane { //set up all object for the scene - private Button[] Level_button = new Button[13]; + public static Button[] Level_button = new Button[13]; //set up the scene private Scene Level_menu; private GridPane GdP; @@ -20,8 +23,13 @@ public class MenuLevelDay1 extends GridPane { super(); GdP = new GridPane(); //add all the button for level - for (Button c : Level_button) - c = new Button((String(c+1))); + HashMap LevelButton = new HashMap(); + + /*for (Map.Entry c : LevelButton) { + c.setValue(new Button()); + required: array or java.lang.Iterable + found: HashMap + }*/ Level_button[0] = new Button("1"); Level_button[1] = new Button("2"); @@ -51,9 +59,9 @@ public class MenuLevelDay1 extends GridPane { GdP.add(Level_button[9],1,4); GdP.add(Level_button[12],2,4); - for( int i= 0;i<=9;i++); + /***for( int i= 0;i<=9;i++); GridPane.setHalignment((Level_button[i],HPos.CENTER));; - //todo understand why it doesn't work + //todo understand why it doesn't work**/ GridPane.setHalignment(Level_button[10], HPos.LEFT); GridPane.setHalignment(Level_button[11], HPos.RIGHT);