javaswingwindowlistener

Swing - How to close a form from inside? How to close the form without affecting the parent form?


I am creating a form in Swing toolkit.
When I want to close it, I go to the JFrame and set it to visible false.
Since the frame creates a Java class of the form, I can easily do it from outside.

When I have a cancel button I usually send a listener inside the form that calls the outer:

 Jframe.setVisible (false)

Is there a better way ?


Solution

  • try these if you do not need to code much! click here to view image