-1

たとえば、次のようなコードがあります。

public static void main(String[] args) {
    JWindow w = new JWindow();
    w.setSize(100, 100);
    w.setVisible(true);
    // some code need to be executed after window is closed, Eg.
    System.out.println("some code need to be executed after window is closed");
}

ウィンドウが閉じられるまでコードを停止w.setVisible(true);/setVisible(false)してから実行したいのですSystem.out.println("window closed");が、これを達成するにはどうすればよいですか?

4

2 に答える 2

-1

ウィンドウを閉じるイベントまたはウィンドウを閉じるイベントを使用できます

 public void windowClosing(WindowEvent e) 
 {
        System.out.println("window closed");
 }

また

  public void windowClosed(WindowEvent e) 
  {
         System.out.println("window closed");
  }
于 2014-08-01T10:29:59.447 に答える