title: JDialog WindowOpened event is fired just once
body: <p>I'm trying to get the <code>WindowOpened</code> event from <code>JDialog</code>, but it is fired just once.
  Why <code>windowClosing</code> works correctly and <code>WindowOpened</code> just once? Is there any way to fire the open event for <code>JDialog</code> every time? </p>
  
  <pre><code>import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.awt.event.WindowEvent;
  
  public class NewClass extends JDialog {
  
      public void init() {
          setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
          setModal(true);
          setSize(100,100);
          setLocationRelativeTo(null);
      }
  
      public void addListener() {
          addWindowListener(
              new java.awt.event.WindowAdapter() {
              public void windowOpened(WindowEvent e) {
                  System.out.println("Invoking WindowOpened from JDialog");
              }
              public void windowClosing(WindowEvent e) {
                  System.out.println("Invoking WindowClosing from JDialog");
                  dispose();
              }
          });
      }
  
      public static void main( String args[]) {
          JFrame f = new JFrame();
          f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          f.setSize(200,70);
  
          final NewClass d = new NewClass();
          d.init();
          d.addListener();
  
          JButton b = new JButton("Show Dialog");
          b.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                  d.setVisible(true);
              }
          });
  
          f.getContentPane().add(b);
          f.setLocationRelativeTo(null);
          f.setVisible(true);
      }
  }
  </code></pre>