Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing a window

Status
Not open for further replies.

LoudHoward

Technical User
May 10, 2001
2
0
0
AU
I am writing a gui app for an assignment at uni. Firstly it has a root window which has buttons to access the aspects of the program (in this case to search the database, list the contents of the db, and do administrative tasks to db). When a button is clicked the event listenter catches the click and creates a new instance of the class (which I have as an inner class atm) that will create the window for that task (e.g search). Now having implemented in this way is the search window considered a child of the root window?

Now for the second question. Each child window will have a close button as well as the close button provided as part of the frame. To get the window to close and thus return to the root window, I understand that I have to use WindowAdapter, but what is the call to kill the child window and return to the root.

I using awt and I am not using threads or anything else special.

Thankyou
LoudHoward :)
 
You want to look at the dispose() method. If using a Frame or JFrame it releases the window resource in memory.

Also, It is not really a child, you are just creating another instance of the object. You should have the other Frame in memory running if you did not dispose() it. When you close a Frame with the WindowAdapter use the dispose() and then it should allow the other windows to be used until their WindowAdapter is triggered and closed.

Good luck,
Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top