> > > I create a JInternalFrame and add it to the JDesktopPane
> > >
[quoted text clipped - 12 lines]
>
> this.getDesktopPane();
This will not work if you are calling getDesktopPane() from the
MyJInternalFrame constructor, since the MyJInternalFrame is not added to
the desktop until after the constructor finishes - the above is somewhat
equivalent of:
MyJInternalFrame myframe = new MyJInternalFrame();
desktop.add( myframe );
myframe = null;
> besides, can't I get refences to all the JInternalFrames from the
> JDesktopPane?
Which object really needs to refer explicitly to the internal frame -
desktop, or the class in which the desktop resides? If you have multiple
JInternalFrames in the desktop, then, sure, you can use
desktop.getAllFrames() to retrieve them, but then you have to figure out
which of them to use for some specific operation. Why not just keep the
reference when you create the JInternalFrame?

Signature
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94 (206)544-5225
Jonathan Kapleau - 12 Jun 2004 02:53 GMT
> > My bad. I subclass the JInternalFrame and from within the code for
> > MyInternalFrame I call it as:
[quoted text clipped - 9 lines]
> desktop.add( myframe );
> myframe = null;
Thanks, this is something I had not considered. Does this still apply
if the MyJInternaFrame constructor calls another method? For example:
public MyJInternalFrame() {
...
launch();
}
void launch() {
...
getDesktopPane();
}
Thanks.