title: Stage is hidden when dialog is shown
body: <p>I have this code which displays confirmation dialog to exit application.</p>
  
  <pre><code>    public class DialogPanels
  {
  
      public void initClosemainAppDialog(final Stage primaryStage)
      {
  
          primaryStage.setOnCloseRequest(new EventHandler&lt;WindowEvent&gt;()
          {
              @Override
              public void handle(WindowEvent event)
              {
                  event.consume(); // Do nothing on close request
  
                  // Dialog Stage init
                  final Stage dialog = new Stage();
                  dialog.initModality(Modality.APPLICATION_MODAL);
  
                  // Frage - Label
                  Label label = new Label("Exit from the program");
  
  
                  // Button "Yes"
                  Button okBtn = new Button("Yes");
                  okBtn.setOnAction(new EventHandler&lt;ActionEvent&gt;()
                  {
                      @Override
                      public void handle(ActionEvent event)
                      {
                          //primaryStage.close();  
                          //dialog.close();
                          //Platform.exit();     
                          System.exit(0);
                      }
                  });
  
                  // Button "No"
                  Button cancelBtn = new Button("No");
                  cancelBtn.setOnAction(new EventHandler&lt;ActionEvent&gt;()
                  {
                      @Override
                      public void handle(ActionEvent event)
                      {
                          primaryStage.show();
                          dialog.close();
                      }
                  });
  
                  // Layout for the Button
                  HBox hbox = new HBox();
                  hbox.setSpacing(10);
                  hbox.setAlignment(Pos.CENTER);
                  hbox.getChildren().add(okBtn);
                  hbox.getChildren().add(cancelBtn);
  
                  // Layout for the Label and hBox
                  VBox vbox = new VBox();
                  vbox.setAlignment(Pos.CENTER);
                  vbox.setSpacing(10);
                  vbox.getChildren().add(label);
                  vbox.getChildren().add(hbox);
  
                  // Stage
                  Scene scene = new Scene(vbox);
                  dialog.setScene(scene);
                  dialog.show();
              }
          });
  
      }
  }
  </code></pre>
  
  <p>The problem is that when close the main application the dialog box is displayed and the main stage is hidden. I want to display the dialog box in front of the main stage. Can you help me to correct this?</p>
  
  <p><em><strong>UPDATE</em></strong></p>
  
  <p>I tested this code, it's working but when the dialog is displayed the mainstage is not responsible(frozen). How I an make the mainstage responsible when I display dialog?</p>