I have an application where I need a non-modal dialog (the Address Book) to be displayed. Also, not more than one Address Book dialog may be open at a time.
So I made a function that is called when the user clicks on the Address Book button, to check if any Address Book dialog is currently open and if so to bring it to the front.
Then, I need to know when the Address Book dialog is closed by any means (for many reasons.) So I added a window listener to the Address Book.
But what I am finding is that when I close the dialog by any means and in doing so, call the two lines of code in endScreen() is that the dialog still exists. When I do Frame.getFrames() I still land up with an instance of AddressBookDialog that is aruond somewhere.
Can anyone explain why this AddressBook is hanging around and how I can make is hide and die quietly?
The is code is partial so no one can find where is the error.
Joined: May 18, 2004
I appologise for posting partial code. I did no think that any other sections of this were relevant in finding the answer. Below I have also posted the code that is called when the Address Book button on the tool bar is pressed.
So to sum up, I have posted the code that gets called to show the new Address Book. This code checks if there is already a frame of the class AddressBookListener existing and if it does exist, that it should show the screen.
I also posted the code that is called when the frame is closed.
After the frame is closed, Frame.getFrames() still contains an instance of AddressBookListener which it should not.
I have posted the portions of the code that I think are relevant and I would be happy to post more if this is still not sufficient.
Many kind regards, Rachel [ May 09, 2005: Message edited by: Rachel Swailes ]
'dispose' is a Window method, see api for details. In general, calling 'dispose' will remove a components peer. The Component will remain in the vm as long as there exists a reference to it. To remove the Component you set all/any references to it to 'null'.
Joined: May 18, 2004
Wow! It's only 8:30AM and already I have learned something new today. Thanks guys for your info and Craig, I always see you on the forums and your advice is always great!