working main screen

master
Cemal Odabasioglu 2022-05-18 10:24:18 +02:00
parent b568c967c6
commit 2e34cb91b4
2 changed files with 17 additions and 6 deletions

View File

@ -58,6 +58,7 @@ public class LaticeApplicationWindow extends Application {
ArrayList<Image> listTileImage = Rack.getRackTileImage();
ArrayList<Tile> listOfTile = new ArrayList<Tile>();
Map<Rectangle, Tile> assocRectangleTile = new HashMap<Rectangle, Tile>();
static BorderPane rootLayout;
public static int indexTileClicked;
@ -261,8 +262,7 @@ public class LaticeApplicationWindow extends Application {
//--------------------------------------------------------------------------------------
Scene scene = new Scene(root, 1280, 720);
setRootLayout(root);
primaryStage.setResizable(false);
primaryStage.setTitle("Latice");
@ -270,8 +270,12 @@ public class LaticeApplicationWindow extends Application {
primaryStage.show();
}
public static void setRootLayout(BorderPane root) {
rootLayout = root;
}
public static BorderPane getRootLayout() {
return rootLayout;
}
@ -289,4 +293,6 @@ public class LaticeApplicationWindow extends Application {
LaticeApplicationWindow.indexTileClicked = indexTileClicked;
}
}

View File

@ -2,10 +2,12 @@ package latice.controller;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import latice.application.LaticeApplicationWindow;
public class MainScreenController extends LaticeApplicationWindow{
@ -20,7 +22,10 @@ public class MainScreenController extends LaticeApplicationWindow{
@FXML
public void playButtonClicked(MouseEvent event) {
System.out.println("playButtonClicked");
Stage stage = (Stage) ((Node) event.getTarget()).getScene().getWindow();
BorderPane root = getRootLayout();
Scene scene = new Scene(root, 1280, 720);
stage.setScene(scene);
}
// Event Listener on Rectangle[#rulesButton].onMouseClicked
@FXML