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

Krzysztof Pokrywka
  • 1,356
  • 4
  • 27
  • 50

1 Answers1

1

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!

Community
  • 1
  • 1
D3181
  • 2,037
  • 5
  • 19
  • 44