Thread View: borland.public.jbuilder.java.swing
4 messages
4 total messages
Started by tom
Tue, 23 Aug 2005 06:07
call an jinternalframe from another jinternalframe
Author: tom
Date: Tue, 23 Aug 2005 06:07
Date: Tue, 23 Aug 2005 06:07
8 lines
1136 bytes
1136 bytes
Hi, how would I call an jinternalframe from another jinternalframe? thanks tom
Re: call an jinternalframe from another jinternalframe
Author: Jeroen Wenting
Date: Tue, 23 Aug 2005 12:52
Date: Tue, 23 Aug 2005 12:52
16 lines
1504 bytes
1504 bytes
"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
Re: call an jinternalframe from another jinternalframe
Author: tom
Date: Wed, 24 Aug 2005 18:36
Date: Wed, 24 Aug 2005 18:36
66 lines
2906 bytes
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
Re: call an jinternalframe from another jinternalframe
Author: Jeroen Wenting
Date: Thu, 25 Aug 2005 10:18
Date: Thu, 25 Aug 2005 10:18
18 lines
1805 bytes
1805 bytes
In that case you should be able to pass panelB a reference to panelA (which creates it I guess?) and have panelA itself keep a reference to panelB. If both are created by another process, that process can provide those references. "tom" <zhangx@gaia.ecs.csus.edu> wrote: >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. >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads