Change a simple button to a choiceBox
This commit is contained in:
parent
c867ff70ce
commit
1df3918718
@ -2,33 +2,40 @@ package school_project.Menu;
|
|||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.ChoiceBox;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.text.Font;
|
import javafx.scene.text.Font;
|
||||||
import school_project.Controller;
|
import school_project.Controller;
|
||||||
public class MenuAccueil extends BorderPane {
|
public class MenuAccueil extends StackPane {
|
||||||
|
|
||||||
|
|
||||||
public MenuAccueil(){
|
public MenuAccueil(){
|
||||||
super();
|
super();
|
||||||
//create all the objet that i need
|
//create all the objet that I need
|
||||||
Button Play = new Button("Play");
|
ChoiceBox SlctDifficulty = new ChoiceBox();
|
||||||
|
SlctDifficulty.getItems().addAll("Easy", "Medium", "Hard");
|
||||||
|
Label RdmLvl = new Label("Random Level : ");
|
||||||
Button SelectLevel= new Button("Select Level");
|
Button SelectLevel= new Button("Select Level");
|
||||||
Button Trophy = new Button("Trophy");
|
|
||||||
Label Title = new Label("Welcome to Road to Master");
|
Label Title = new Label("Welcome to Road to Master");
|
||||||
//set up all the Button where i need
|
|
||||||
setTop(Title);
|
//set up all the Button where I need
|
||||||
setLeft(Play);
|
getChildren().addAll(Title,SlctDifficulty,SelectLevel,RdmLvl);
|
||||||
setRight(SelectLevel);
|
RdmLvl.setFont(Font.font(25));
|
||||||
setBottom(Trophy);
|
RdmLvl.setTextFill(Color.GOLD);
|
||||||
Title.setFont(Font.font(20));
|
Title.setFont(Font.font(40));
|
||||||
Title.setTextFill(Color.GOLD);
|
Title.setTextFill(Color.RED);
|
||||||
setAlignment(Title, Pos.CENTER);
|
setAlignment(Title, Pos.TOP_CENTER);
|
||||||
setAlignment(Play,Pos.CENTER);
|
setAlignment(SlctDifficulty,Pos.CENTER_LEFT);
|
||||||
setAlignment(SelectLevel,Pos.CENTER);
|
setAlignment(SelectLevel,Pos.CENTER_RIGHT);
|
||||||
setAlignment(Trophy,Pos.CENTER);
|
setAlignment(RdmLvl, Pos.CENTER_LEFT);
|
||||||
setPadding(new Insets(20,60,20,60));
|
|
||||||
|
setMargin(RdmLvl,new Insets(0,0,0,100));
|
||||||
|
setMargin(SlctDifficulty,new Insets(0,0,0,300));
|
||||||
|
setMargin(SelectLevel,new Insets(0,300,0,0));
|
||||||
|
setMargin(Title,new Insets(200,0,0,0));
|
||||||
|
|
||||||
SelectLevel.setOnAction(event -> Controller.switchRoot(new MenuLevel(1)));
|
SelectLevel.setOnAction(event -> Controller.switchRoot(new MenuLevel(1)));
|
||||||
getStyleClass().add("BorderPane");
|
getStyleClass().add("BorderPane");
|
||||||
getStylesheets().add(String.valueOf(getClass().getResource("StyleMenuAcceuil.css")));
|
getStylesheets().add(String.valueOf(getClass().getResource("StyleMenuAcceuil.css")));
|
||||||
|
Loading…
Reference in New Issue
Block a user