2012-01-21 11 views
0

ButtonActionPerformEvent呼び出しを作成しました。メソッド呼び出しは、メソッド呼び出しformwindowclosingイベントを処理します。現在のクラスのために、別のクラスに私がのsetVisible真とantoherクラスオブジェクトを作成するButtonActionPerformEventでformWindowClosingイベントを呼び出す方法

private void Cmd01ActionPerformed(java.awt.event.ActionEvent evt) {          
      GVar=Txt01.getText(); 
      dispose(**formWindowClosing**(-)); // how i can pass form closing event here. 
    } 

1以上FormWindowClosingイベントを開きます。

private void formWindowClosing(java.awt.event.WindowEvent evt) {         
     new GlobalVariableClass2().setVisible(true); //another class 
} 

この問題から私を助けてください。すべてこの質問の最初の

答えて

3

1)は、あなたが持っている、たくさんTop Level Containerを作成し、別の使用のためにそれを再利用しないTop Level Container

2)のためcreate/close/dipose/setVisibleを呼び出すためにそれはむしろCardLayoutを使用釈明ではありませんsetVisibleを探して、この場合はsetDefaultCloseOperation to HIDE_ON_CLOSEを設定する必要があります。それぞれの通知はTop Level Containerです。

+0

okでも、私はsetDefaultCloseOperationを使用して1つのイベントを呼び出すことができますrイベントプライベートvoid Cmd01ActionPerformed(ActionEvent evt){ GVar = Txt01.getText(); // dispose(getWindows(formWindowClosing(new WindowEvent()))); setDefaultCloseOperation(); getWindows(formWindowClosing()); } private void formWindowClosing(java.awt.event.WindowEvent evt){ 新しいGlobalVariableClass2()。setVisible(true); } – javasi

+2

あなたは何を試してみましたか?本当に助けてください。http://sscce.org/で質問を編集してください。 – mKorbel

関連する問題