JavaFX 2.2 Stage always on top

后端 未结 4 1797
Happy的楠姐
Happy的楠姐 2020-12-06 01:19

I have a normal JFrame (one part of the app) and a second JavaFX window (I can\'t use a JFrame for the JavaFX stage). The problem is that the JavaFX window should always be

4条回答
  •  悲&欢浪女
    2020-12-06 01:36

    Like this (I'm using Alert)

     Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
     stage.setAlwaysOnTop(true);
    

    If you want it on top always blocking other windows, just set:

    alert.initModality(Modality.APPLICATION_MODAL);
    

提交回复
热议问题