Content received from: http://JavaFAQ.nu/java-article210.html


How can my application dispose or close a Frame from another Frame AWT? For exam
Friday, September 26, 2003 (00:00:00)

Posted by jalex

Question: How can my application dispose or close a Frame from another Frame AWT? For example I press button and another frame disappears...

Answer: easy! Event handling procedure add following code for example,
if(e.getSource() == buttonOK){
frameName.dispose();
}

or

framename.setVisible(false);

Remember, last method will still keep frame object alive and waste memory.
And dispose() method releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. That is, the resources for these Components will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable.

*******************************************
Our older tips: March 22, 2001 - October 21, 2002 READ HERE
All published and not published on the site tips read HERE