title: Buttons in JDialog not clickable when it's on top of other two modal popups
body: <p>I have a swing application.I have a Window which should be showed on clicking of few text fields.(It's like a virtual keyboard with few keys).
  That window is created using</p>
  
  <pre><code>Window wdw= new JDialog();
  </code></pre>
  
  <p>It's set to modal as well. <code>((JDialog) wdw).setModal(true);</code></p>
  
  <p>The keys have mouse listener added. On clicking and holding of keys, it shows another JDialog with showing extra few buttons.</p>
  
  <p>Below is the method to create that window which is called on press and hold of a key.</p>
  
  <pre><code>private void createPopupKeys(MouseEvent e) {
      JButton keyBtn = (JButton)e.getSource();
      Window parentWindow = SwingUtilities.windowForComponent(keyBtn);
      Window dialog = new JDialog(parentWindow);
      dialog.setFocusable(true);
      dialog.setFocusableWindowState(true);
  
      JPanel contP = (JPanel)((JDialog) dialog).getContentPane();
      contP.setPreferredSize(new Dimension(150, 40));
      JPanel pnl = new JPanel();
  
      String[][] popupKeys = {{"123","123","123"},
                              {"124","124","196"},
                              {"125","125","197"},
                              {"126","126","198"},
                              };
      for (int i = 0; i &lt; popupKeys.length; i++) {
          JButton btn = new JButton(popupKeys[i][0]);
          btn.setActionCommand(popupKeys[i][2]);
          btn.setName("popupkey"+i);
          btn.addMouseListener(this);
          btn.setMinimumSize(new Dimension(30, 30));
          btn.setPreferredSize(new Dimension(30, 30));
          btn.setFocusable(false);
          btn.setFont(new Font("Dialog", Font.BOLD, 14));
          pnl.add(btn);
      }
  
      pnl.setPreferredSize(new Dimension(150, 40));
      contP.add(pnl);
              dialog.setAlwaysOnTop(true);
      Point loc = keyBtn.getLocationOnScreen();
      dialog.setLocation(loc.x - 20 , loc.y - 50);
      dialog.pack();
  
      dialog.setVisible(true);
  
      dialog.addWindowFocusListener(windowListener);
      dialog.addWindowListener(windowListener);
  }
  
  WindowAdapter windowListener = new WindowAdapter() {
      @Override
      public void windowLostFocus(WindowEvent e) {
          JDialog dialog = (JDialog) e.getSource();
          dialog.setVisible(false);
          dialog.dispose();
      }
  };
  </code></pre>
  
  <p>In normal window, when I click on a text field, the modal window is opened, and on press and hold of a key, the new popup key dialog is opened and all are clickable.</p>
  
  <p>But when I click on a text field in a modal popup, the window is opened and on press and hold of a key, the popup keys are displayed also. But no buttons in popup keys are clickable.</p>
  
  <p>What could be the reason? And whats the solution?</p>