I'm working on a mini application where I need to display to users 2 windows at the same time but on Fullscreen (the application will be made for users on dual screen).
I'm working with JavaFx Scene Builder 2.0 on NetBeans 8.0.1
I tried this but only the second window gets displayed on fullscreen.
public void showTwoScreens() {
try {
Parent root = FXMLLoader.load(getClass().getResource("ClientsOperationsWindow.fxml"));
Scene scene = new Scene(root);
globalStage.setScene(scene);
globalStage.setFullScreen(true);
globalStage.setResizable(true);
globalStage.show();
Stage anotherStage = new Stage();
Parent secondRoot = FXMLLoader.load(getClass().getResource("ClientsSearchWindow.fxml"));
Scene secondStage = new Scene(secondRoot);
secondStage.setScene(anotherScene);
secondStage.setFullScreen(true);
secondStage.show();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
is it possible to display two windows on fullscreen ?
Thank you!
I think you can't set two stages in fullscreen in two monitors at the same time, but you can get the same result, by forcing the stage dimensions.
For that, we'll use
javafx.stage.Screen
, to get the characteristics for each of the different monitors connected. Then we load the fxml files to each scene, and display each scene on its stage. WithScreen.getBounds()
we now the origin and dimensions of the rectangle, refered to the primary screen. So we set each stage bounds with the bounds of these rectangles. Finally we set the style to undecorated. The only feature missing now is an exit "fullscreen" mode key combination.