Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to launch JInternalFrame from a JTabbedPane

 
Sri Rangan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My main GUI in a JInternalFrame and it has a JTabbedPane. I would like to open a another JInternalFrame from one of the Panels in the JTabbedPane. I use the following code to do that.
<code>
SecondInternalFrame iFrame = new SecondInternalFrame();
iFrame.show();
iFrame.setVisible(true);
</code>
But I don't seee the second Internal Frame opening. Am I doing something wrong?
Thanks
Sri
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't quite understand your question. So you have a JInteralFrame that has a JTabbedPane inside it.
Now, are you wanting to create a new JInternalFrame on your JDesktopPane OR are you wanting to create a JInternalFrame inside a panel on your JTabbedPane?
If the latter is your desire, I don't think you can without putting another JDesktopPane inside the Panel of the JTabbedPane and I don't event know if that is possible.
 
Sri Rangan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a new JInternalFrame on my JDesktopPane.
How do I get my JDeskTopPane from the panel inside the JTabbedPane?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on how you have your classes set up. Can we see your code. Then we can better help.
 
Sri Rangan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregg,
My class hierarchy is as below:
JComponent
-JInternalFrame
-MyInternalFrame
-MyNoteBook (This has JTabbedPane)

MyInternalFrame has method() called findDesktop() which will return my VirtualDesktop class which extends from JDesktopPane.
Once I get my VirtualDEskTop I can use it to open my next JInternalFrame class.
The proplem is, how to call findDesktop() class from a panel inside the JTabbedPane.
I tried using getParent() on the panel to get the JTabbedPane. But I do not know how to call the findDesktop() method.
Thanks
Sri
 
Sri Rangan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would appreciate any help
Thanks
Sri
 
Tanveer Rameez
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
in MyNoteBook class I guess u r having something similar to this code:

let's say firstpanel is an object of MyPanel class that extends JPanel. If something is done in this firstpanel a JInternalFrame should appear on the JDesktopPane (or VirtualDesktop) on the MyNoteBook. for this in the class MyPanel should be able to access the JDesktopPane of MyNoteBook.
to enable this you can have the previous code as:

The MyPanel class can then store this MyNoteBook reference in a memeber variable of type MyNoteBook. Now whenever it wants it can invoke the method finddesktop() of MyNoteBook.

hope this helps
Tanveer Rameez
*********************
Originally posted by Sri Rangan:
Gregg,
My class hierarchy is as below:
JComponent
-JInternalFrame
-MyInternalFrame
-MyNoteBook (This has JTabbedPane)
MyInternalFrame has method() called findDesktop() which will return my VirtualDesktop class which extends from JDesktopPane.
Once I get my VirtualDEskTop I can use it to open my next JInternalFrame class.
The proplem is, how to call findDesktop() class from a panel inside the JTabbedPane.
I tried using getParent() on the panel to get the JTabbedPane. But I do not know how to call the findDesktop() method.
Thanks
Sri

[ May 20, 2002: Message edited by: Tanveer Rameez ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic