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?
 
     
    