"stage.setAlwaysOnTop(true)" and "alert.showAndWait()" may cause app block

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: jfx13
    • Component/s: javafx

      A DESCRIPTION OF THE PROBLEM :
      I met following scenario:
      1)Stage A is set as "setAlwaysOnTop(true)".
      2) Stage B pops an Alert to have user select some buttons.
      3) Stage A is on top and covering buttons of the Alert.
      Then app is blocking: Stage A can not get focus before user click buttons on Alert but Alert is unavaliable before stage A is moved away from top of it.

      This happens due to Alert's not bring itself to front. When it stays under others, problem happens.

      I found following solution:
      https://stackoverflow.com/questions/38799220/javafx-how-to-bring-dialog-alert-to-the-front-of-the-screen?r=SearchResults
      And solved this problem by adding following lines for all alerts in my app:
      Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
      stage.setAlwaysOnTop(true);
      stage.toFront();

      But I do not think this is the right way to avoid this problem. Maybe Alert need always bring itself to top automatically to avoid blocking whole application.



            Assignee:
            Unassigned
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: