Sub element from Controller to a new class
This commit is contained in:
parent
25a6782f3c
commit
075bdd9338
@ -94,39 +94,7 @@ public class Controller extends Application {
|
|||||||
private Scene createLevel_menu(){
|
private Scene createLevel_menu(){
|
||||||
bck_menu = new Button("Back to the menu");
|
bck_menu = new Button("Back to the menu");
|
||||||
bck_menu.setOnAction(event -> switchScenes(Menu));
|
bck_menu.setOnAction(event -> switchScenes(Menu));
|
||||||
GdP = new GridPane();
|
|
||||||
Level_menu = new Scene(GdP,700,400);
|
|
||||||
_1 = new Button("1");
|
|
||||||
_2 = new Button("2");
|
|
||||||
_3 = new Button("3");
|
|
||||||
_4 = new Button("4");
|
|
||||||
_5 = new Button("5");
|
|
||||||
_6 = new Button("6");
|
|
||||||
_7 = new Button("7");
|
|
||||||
_8 = new Button("8");
|
|
||||||
_9 = new Button("9");
|
|
||||||
_10 = new Button("10");
|
|
||||||
Day_2 = new Button("Day 2");
|
|
||||||
Day_3 = new Button("Day 3");
|
|
||||||
|
|
||||||
//set up of the button
|
|
||||||
GdP.add(Day_2,1,0);
|
|
||||||
GdP.add(Day_3,1,0);
|
|
||||||
GdP.add(_1,0,1);
|
|
||||||
GdP.add(_2,1,1);
|
|
||||||
GdP.add(_3,2,1);
|
|
||||||
GdP.add(_4,0,2);
|
|
||||||
GdP.add(_5,1,2);
|
|
||||||
GdP.add(_6,2,2);
|
|
||||||
GdP.add(_7,0,3);
|
|
||||||
GdP.add(_8,1,3);
|
|
||||||
GdP.add(_9,2,3);
|
|
||||||
GdP.add(_10,1,4);
|
|
||||||
GdP.add(bck_menu,2,4);
|
|
||||||
//set up gap and padding and everything else
|
|
||||||
GdP.setHgap(20);
|
|
||||||
GdP.setVgap(20);
|
|
||||||
GdP.setPadding(new Insets(40,20,20,40));
|
|
||||||
ColumnConstraints col_1 = new ColumnConstraints();
|
ColumnConstraints col_1 = new ColumnConstraints();
|
||||||
col_1.setPercentWidth(33);
|
col_1.setPercentWidth(33);
|
||||||
ColumnConstraints col_2 = new ColumnConstraints();
|
ColumnConstraints col_2 = new ColumnConstraints();
|
||||||
|
54
app/src/main/java/school_project/MenuLevelDay1.java
Normal file
54
app/src/main/java/school_project/MenuLevelDay1.java
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package school_project;
|
||||||
|
|
||||||
|
import javafx.geometry.HPos;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.layout.ColumnConstraints;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
|
||||||
|
public class MenuLevelDay1 extends Controller {
|
||||||
|
//set up all object for the scene
|
||||||
|
private Button Day_2;
|
||||||
|
private Button Day_3;
|
||||||
|
private Button[] Level_button = new Button[10];
|
||||||
|
//set up the scene
|
||||||
|
private Scene Level_menu;
|
||||||
|
private GridPane GdP;
|
||||||
|
private Button bck_menu;
|
||||||
|
|
||||||
|
private Scene createLevel_menu(){
|
||||||
|
GridPane GdP = new GridPane();
|
||||||
|
Level_menu = new Scene(GdP,700,400);
|
||||||
|
//add all the button for level
|
||||||
|
_1 = new Button("1");
|
||||||
|
_2 = new Button("2");
|
||||||
|
_3 = new Button("3");
|
||||||
|
_4 = new Button("4");
|
||||||
|
_5 = new Button("5");
|
||||||
|
_6 = new Button("6");
|
||||||
|
_7 = new Button("7");
|
||||||
|
_8 = new Button("8");
|
||||||
|
_9 = new Button("9");
|
||||||
|
_10 = new Button("10");
|
||||||
|
Day_2 = new Button("Day 2");
|
||||||
|
Day_3 = new Button("Day 3");
|
||||||
|
bck_menu = new Button("Back to menu");
|
||||||
|
//add to the good position in gridpane all the button
|
||||||
|
GdP.add(Day_2,1,0);
|
||||||
|
GdP.add(Day_3,1,0);
|
||||||
|
GdP.add(_1,0,1);
|
||||||
|
GdP.add(_2,1,1);
|
||||||
|
GdP.add(_3,2,1);
|
||||||
|
GdP.add(_4,0,2);
|
||||||
|
GdP.add(_5,1,2);
|
||||||
|
GdP.add(_6,2,2);
|
||||||
|
GdP.add(_7,0,3);
|
||||||
|
GdP.add(_8,1,3);
|
||||||
|
GdP.add(_9,2,3);
|
||||||
|
GdP.add(_10,1,4);
|
||||||
|
GdP.add(bck_menu,2,4);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user