0

I have a problem and don't find a solution.

I have two different forms created with Java Swing and if I click a Button on the first form, than the second form is setVisible(true) and the first form is setVisible(false). When the user now clicks the X on the top right hand corner the second form should be disposed and the first form should setVisible(true).

So how is it possible to execute code when clicking the X?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Broki
  • 3
  • 1

1 Answers1

0

Have you tried adding a actionListener to the X?

Like it's done here: Java Swing adding Action Listener for EXIT_ON_CLOSE