Finally finish the menu
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Mat 2023-05-05 11:50:17 +02:00
parent 8110a93910
commit a3ad448fba
5 changed files with 21 additions and 91 deletions

View File

@ -7,8 +7,7 @@ import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.stage.Stage; import javafx.stage.Stage;
import school_project.Menu.MenuAcceuil; import school_project.Menu.*;
import school_project.Menu.MenuLevel;
@ -24,12 +23,10 @@ public class Controller extends Application {
root = new MenuAcceuil(); root = new MenuAcceuil();
stage = primaryStage; stage = primaryStage;
stage.setTitle("ROAD TO MASTER YOU"); stage.setTitle("ROAD TO MASTER");
stage.setScene(new Scene(root)); stage.setScene(new Scene(root));
stage.show(); stage.show();
} }

View File

@ -33,6 +33,9 @@ public class MenuAcceuil extends BorderPane {
//Menu.getStylesheets().add("style.css"); todo creat a file css //Menu.getStylesheets().add("style.css"); todo creat a file css
setPadding(new Insets(20,60,20,60)); setPadding(new Insets(20,60,20,60));
SelectLevel.setOnAction(event -> Controller.switchRoot(new MenuLevel(1))); SelectLevel.setOnAction(event -> Controller.switchRoot(new MenuLevel(1)));
getStyleClass().add("BorderPane");
getStylesheets().add(String.valueOf(getClass().getResource("StyleMenuAcceuil.css")));
} }

View File

@ -18,6 +18,7 @@ public class MenuLevel extends GridPane {
public MenuLevel(int choose_day) { public MenuLevel(int choose_day) {
BckMenu = new Button("Back to menu"); BckMenu = new Button("Back to menu");
BckMenu.setOnAction(event -> Controller.switchRoot(new MenuAcceuil())); BckMenu.setOnAction(event -> Controller.switchRoot(new MenuAcceuil()));
setHalignment(BckMenu,HPos.CENTER);
add(BckMenu,2,4); add(BckMenu,2,4);
for (int i = 0; i < Days.length; i++){ for (int i = 0; i < Days.length; i++){
Days[i] = new Button("Day"+(i+1)); Days[i] = new Button("Day"+(i+1));
@ -78,7 +79,7 @@ public class MenuLevel extends GridPane {
} }
for(int i=0;i<=2;i++){ for(int i=0;i<=2;i++){
Columns[i] = new ColumnConstraints(); Columns[i] = new ColumnConstraints();
Columns[i].setPercentWidth(30); Columns[i].setPercentWidth(33);
getColumnConstraints().addAll(Columns[i]); getColumnConstraints().addAll(Columns[i]);
} }
for (int i= 0;i<=4;i++){ for (int i= 0;i<=4;i++){
@ -89,8 +90,12 @@ public class MenuLevel extends GridPane {
setHgap(20); setHgap(20);
setVgap(20); setVgap(20);
setPadding(new Insets(20,10,10,20)); setPadding(new Insets(20,10,10,20));
setGridLinesVisible(true); getStyleClass().add("GridPane");
alignmentProperty(); getStylesheets().add(String.valueOf(getClass().getResource("StyleMenuAcceuil.css")));

View File

@ -1,83 +0,0 @@
package school_project.Menu;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
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
public static Button[] Level_button = new Button[13];
//set up the scene
private Scene Level_menu;
private GridPane GdP;
public MenuLevelDay1 (){
super();
GdP = new GridPane();
//add all the button for level
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");
Level_button[2]= new Button("3");
Level_button[3]= new Button("4");
Level_button[6] = new Button("7");
Level_button[7] = new Button("8");
Level_button[8] = new Button("9");
Level_button[9] = new Button("10");
Level_button[10] = new Button("Day 2");
Level_button[11] = new Button("Day 3");
Level_button[12] = new Button("Back to menu");
Level_button[4] = new Button("5");
Level_button[5]= new Button("6");
//add to the good position in gridpane all the button
GdP.add(Level_button[10],1,0);
GdP.add(Level_button[11],1,0);
GdP.add(Level_button[0],0,1);
GdP.add(Level_button[1],1,1);
GdP.add(Level_button[2],2,1);
GdP.add(Level_button[3],0,2);
GdP.add(Level_button[4],1,2);
GdP.add(Level_button[5],2,2);
GdP.add(Level_button[6],0,3);
GdP.add(Level_button[7],1,3);
GdP.add(Level_button[8],2,3);
GdP.add(Level_button[9],1,4);
GdP.add(Level_button[12],2,4);
/***for( int i= 0;i<=9;i++);
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[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);
}
}

View File

@ -0,0 +1,8 @@
.BorderPane{
-fx-background-image: url("BackGround-menu.jpg");
-fx-background-position:center;
}
.GridPane{
-fx-background-image: url("Background-select-level.jpg");
-fx-background-position:right;
}