Set Height and Width of Stage and Scene in javafx

后端 未结 3 1985
鱼传尺愫
鱼传尺愫 2021-02-07 08:37
  • I develop one javafx application.
  • In my application there are two scenes and one stage.
  • In application the height and width for both scenes are same or c
3条回答
  •  抹茶落季
    2021-02-07 09:20

    I know this is an old topic, but this (bug?) still persists in Java7u75.

    I ran into the same issue... the solution offered by shambhu above does work, but results in a visible "window switching" effect:

    stage.hide();
    stage.show();
    

    I found that the following code solves the problem (gets the stage to "refresh") without any visible effects:

    final boolean resizable = stage.isResizable();
    stage.setResizable(!resizable);
    stage.setResizable(resizable);
    

提交回复
热议问题