🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #343

Re: call an jinternalframe from another jinternalframe

#343
From: tom
Date: Wed, 24 Aug 2005 18:36
66 lines
2906 bytes
I tried to reference desktop from the mainFrame JDesktop and it always 
returns null, and
When I tried to launch JPanelB from JPanelA, it failed due to null desktop.
I can launched both JPanelA and JPanelB as internalframe from the mainFrame 
dropdown menubar as menu items.


Basically, I have a button on JPanelA (already loaded internalFrame). When 
user click on this button, it launches JPanelB as internalFrame and put it 
on the JDesktop just as JPanelA was.



Thanks for any helps

Tom

 ------------------------------
JPanelA:

Public JPanelA{
....
//reference mainFram extends JFrame
mainFrame parentFrame = (mainFrame) 
(this.getParent().getParent().getParent());
JDesktopPane desktop = parentFrame.desktop;

dosomething();

}

protected void dosomething(){

JInternalFrame iframe = new JInternalFrame("test",true,true,true,true);
JPanelB loading = new JPanelB()   //reference another JPanel to be used for 
the internalFrame.

 iframe.getContentPane().add(loading);
desktop.add(iframe, JLayeredPane.DEFAULT_LAYER );
iframe.setSize (750,550);
iframe.setVisible(true);
 }

----------------------------------------

"Jeroen Wenting" <jwenting@hotmail.com> wrote in message 
news:430b1c0b$1@newsgroups.borland.com...
>
> "tom" <xena_bz@hotmail.com> wrote:
>>Hi,
>>
>>how would I call an jinternalframe from another jinternalframe?
>>
>>thanks
>>
> You'd need a reference to it.
> If you don't have that and can't get it, there's no way you can call it.
>
> You can use this.getDesktopFrame().getAllFrames() on your JInternalFrame 
> to get a list of the JInternalFrames which are children of the same 
> JDesktopFrame your JInternalFrame belongs to.
>
> It's up to you to then recognise the one you want if you want to do 
> something to a specific one rather than each of them.
>
> Jeroen Wenting 
Technical Details
Message-ID: <430cbe0a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <430abd12@newsgroups.borland.com> <430b1c0b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,95e5dbb679836a42
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "tom" <zhangx@gaia.ecs.csus.edu>
From: "tom" <zhangx@gaia.ecs.csus.edu>
Newsgroups: borland.public.jbuilder.java.swing
References:  <430abd12@newsgroups.borland.com> <430b1c0b$1@newsgroups.borland.com>
Subject: Re: call an jinternalframe from another jinternalframe
Date: Wed, 24 Aug 2005 11:36:27 -0700
Lines: 68
Organization: java developer beginner
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 136.200.198.187
Message-ID: <430cbe0a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1124908554 136.200.198.187 (24 Aug 2005 11:35:54 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail