Skip to content
Snippets Groups Projects
Commit 4863115a authored by Tran Peter's avatar Tran Peter
Browse files

fix(ui): fix main menu loading double borders if scenes switch back to main menu

parent ff08953d
No related branches found
No related tags found
4 merge requests!74V1,!73Initial commit,!71Merge DataBase into Development,!4Merge UI into Development
......@@ -9,11 +9,13 @@ import javafx.stage.Stage;
public class MainMenuController extends SceneLoader {
@FXML public BorderPane parent;
@FXML public Button exitButton;
public static Pane center;
public void playScene() {
// saving Borderpane without borders as regular pane so after switching scenes back to main menu it won't load the entire Borderpane, instead only the center content. Will fix the static and public identifier in the future
center = (Pane) parent.getCenter();
Pane pane = new Pane(loadScene("Play"));
// get(0) returns the first item from the getChildren() List
parent.getChildren().clear();
parent.setCenter(pane.getChildren().get(0));
}
......
......@@ -8,8 +8,9 @@ public class PlayController extends SceneLoader {
@FXML public BorderPane parent;
public void mainMenuScene() {
Pane pane = new Pane(loadScene("MainMenu"));
parent.setCenter(pane.getChildren().get(0));
// Pane pane = new Pane(loadScene("MainMenu"));
// parent.setCenter(pane.getChildren().get(0));
parent.setCenter(MainMenuController.center);
}
public void localScene() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment