Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: Dispose ActionEvent from different JFrame

I want one JFrame to have a method like this:

private void someEvent(java.awt.event.ActionEvent evt){

    //initialize another JFrame
    //set the new JFrame to be visible
    //set this JFrame to be disabled

}

Which is possible, but I also want the main JFrame to perform something when the newly created JFrame is disposed. I don't want to pass in the main JFrame to the new JFrame however. Is this possible?

like image 892
Blackvein Avatar asked Mar 08 '26 08:03

Blackvein


1 Answers

Instead, use CardLayout to switch between the two desired content panes. There's an example here.

like image 94
trashgod Avatar answered Mar 09 '26 21:03

trashgod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!