-3
  this.setDefaultCloseOperation(this.DISPOSE_ON_CLOSE);
        this.addWindowListener(new WindowAdapter()
    {
      public void windowClosing(WindowEvent e)
      {
          new AddPatient().setVisible(false);
          new SearchPatient().setVisible(true);
      }
    });

上面的代码有问题。这是触发另一个JFrame的dispose和setVisible的正确方法吗?

有人可以告诉我这是正确的编码方式吗?

4

1 回答 1

4

当然。

frame.addWindowListener(new WindowAdapter()
{
  public void windowClosing(WindowEvent e)
  {
      //open other frame
  }
});
于 2013-04-10T05:15:26.167 回答