Hi,
I was wondering if someone might be able to shed some light on a problem
that I have. This application that I am writing has several JInternalFrames
but some of them can only have one instance open at any time. So in my
application I have references to these specific internal frames.
Right now I have it set up so that when the user clicks on the menu item to
open the internal frame, if the reference is null then the internal frame is
created otherwise is does a selectFrame(true). When the internal frame is
closed I hide it and then call dispose(). However, after the dispose() is
called the reference isn't turning into a null so when the user clicks on
the menu item a second time the internal frame doesn't show up.
I have read a couple of messages on the newsgroups which seem to indicate
that if the reference isn't becoming null it is probably because there are
some event handlers that aren't giving up their references. I also have
done a toString() while the internal frame is active and after it has had
its dispose() called. The toString() text looks almost identical except for
the fact that in the disposed toString() there is an "invalid" text
presumable to indicate that the internal frame is invalid.
I guess my question is three parts:
1) Is there a way to find out what references to the internal frame still
exist at the time you wish to close the internal frame? I am assuming that
this could be one of the reasons that my reference to the internal frame
isn't becoming null after I call dispose();
2) Is there a way to find out if the internal frame is "invalid" after I
call the dispose(). In this case I could simply assign null to my reference
of the internal frame and then go about creating a new instance of it.
3) May be someone could suggest a better way to control how many instances
of a specific internal frame are created at any given time. Like I said
before, I only want one instance of this internal frame displayed at any
given time.
Any light that someone could suggest would be of great help to me. Thank
you.
--
Richard Morris
rm******@shaw.ca