2
What is the best way to navigate from one screen to another using Javafx. The way I’m doing every time the first screen calls the second screen the second screen opens with the size of the first.
That’s what I call the second screen:
Parent root = FXMLLoader.load(getClass().getResource("frmPegaXml.fxml"));
SistemaDemonstrativos.SCENE.setRoot(root);
This is my Main:
public static Scene SCENE;
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("frmLogin.fxml"));
Scene scene = new Scene(root);
SCENE = scene;
setUserAgentStylesheet(STYLESHEET_MODENA);
stage.setResizable(false);
//scene.getStylesheets().add("css/JMetroLightTheme.css");
stage.centerOnScreen();
stage.getIcons().add(new javafx.scene.image.Image("icons/1432842939_chart-icon-tm.png"));
stage.setTitle("Titulo");
stage.setScene(scene);
stage.show();
}