menu #43

Merged
Mat_02 merged 20 commits from menu into master 2023-05-09 15:52:14 +02:00
3 changed files with 32 additions and 15 deletions
Showing only changes of commit b4b89bcd86 - Show all commits

View File

@ -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;
Review

tu pourrais faire un appel à #L33 (switchRoot) dans un premier temps ca ne changer rien mais si on change la façon de changer de scene un moment ca sera alors plus cohérent!

tu pourrais faire un appel à #L33 (switchRoot) dans un premier temps ca ne changer rien mais si on change la façon de changer de scene un moment ca sera alors plus cohérent!
Review

en gros au lieu de faire

        stage.setScene(new Scene(root));

Tu pourrais faire

        switchRoot(root);

Ca ne changerait pas grand chose pour l'instant mais si plus tard dans le code on a besoin de changer le fonctionnement de Scene par expemple, alors ca serait plus simple à changer.

en gros au lieu de faire ```java stage.setScene(new Scene(root)); ``` Tu pourrais faire ```java switchRoot(root); ``` Ca ne changerait pas grand chose pour l'instant mais si plus tard dans le code on a besoin de changer le fonctionnement de Scene par expemple, alors ca serait plus simple à changer.
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();
}
tonitch marked this conversation as resolved
Review

pourquoi ?

pourquoi ?

View File

@ -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 {
tonitch marked this conversation as resolved
Review

Ces Variable (sauf selectlevel) peuvent

Ces Variable (sauf `selectlevel`) peuvent
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));
tonitch marked this conversation as resolved
Review

a enlever

a enlever
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);
tonitch marked this conversation as resolved
Review

pour plus de lisibilitée quelques espaces seraient cool

pour plus de lisibilitée quelques espaces seraient cool
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
}

View File

@ -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<String, Button> LevelButton = new HashMap<String, Button>();
/*for (Map.Entry<String,Button> c : LevelButton) {
c.setValue(new Button());
required: array or java.lang.Iterable
found: HashMap<String,Button>
}*/
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);