Reputation: 1
Hi I have applications with two stages . I want to display one stage on one monitor on full screen. I don't know how I can do it. Thanks for help
Upvotes: 1
Views: 551
Reputation: 2102
To quote someone eleses answer on SO
You can iterate Screen.getScreens() and move your stage to required one. See example below.
Specifically the screen class as mentioned:
for (Screen screen : Screen.getScreens()) {
Rectangle2D bounds = screen.getVisualBounds();
Button btn = new Button("Move me to Screen " + index++);
btn.setOnAction((e) -> {
stage.setX(bounds.getMinX() + 100);
stage.setY(bounds.getMinY() + 100);
});
root.getChildren().add(btn);
}
This will essentially use the bounds of each screen allocated to each screen and you can then set the X and Y value of each stage you wish to move to whichever screen.
Hope this helps, if you have any issues let me know and good luck with your project!
Upvotes: 1