JFrame with a JDesktopPane

  • Follow


Hi,

I have an application that makes use of internal frames within a
jdesktoppane. However I want to use a jar that creates a JFrame and
somehow display this inside my desktoppane. Is this actually possible
as they are both heavyweight components. I really want to use the
JFame as though it is a internal frame within the JDesktoppane

Thanks

Steve
0
Reply swebb99 2/28/2010 12:30:34 PM

swebb99@gmail.com wrote:

> I have an application that makes use of internal frames within a
> jdesktoppane. However I want to use a jar that creates a JFrame and
> somehow display this inside my desktoppane. Is this actually possible
> as they are both heavyweight components. I really want to use the

The term you want is "top-level" component.  "Heavyweight component" refers to 
AWT components, which work with companion native components from the host OS. 
  JFrame is a "lightweight" component in that it's pure Java.

> JFame as though it is a internal frame within the JDesktoppane

If only there were some sort of JFrame that works as an internal frame, a kind 
of "JInternalFrame", if you will.  If only ...
<http://java.sun.com/javase/6/docs/api/javax/swing/JInternalFrame.html>

-- 
Lew
0
Reply Lew 2/28/2010 2:41:18 PM


In article <hmdvaf$h95$1@news.albasani.net>, Lew <noone@lewscanon.com> 
wrote:

> swebb99@gmail.com wrote:
> 
> > I have an application that makes use of internal frames within a 
> > jdesktoppane. However I want to use a jar that creates a JFrame and 
> > somehow display this inside my desktoppane. Is this actually 
> > possible as they are both heavyweight components. I really want to 
> > use the
> 
> The term you want is "top-level" component.  "Heavyweight component" 
> refers to AWT components, which work with companion native components 
> from the host OS. JFrame is a "lightweight" component in that it's 
> pure Java.

If I may amplify, here's more on "Using Top-Level Containers" [1].

> > JFame as though it is a internal frame within the JDesktoppane
> 
> If only there were some sort of JFrame that works as an internal 
> frame, a kind of "JInternalFrame", if you will.  If only ...
> <http://java.sun.com/javase/6/docs/api/javax/swing/JInternalFrame.html>

Although JInternalFrame [2] isn't actually a top-level container, it 
shares an essential convenience with JFrame [3]: "add and its variants, 
remove and setLayout have been overridden to forward to the contentPane 
as necessary" [2,3].

In practical terms, this means you may have to look inside your JAR's 
API to see how it fills its JFrame and do the same thing in your 
JInternalFrame. Some APIs have factory methods that create an easily 
added, generally useful panel. The JFreeChart class ChartFactory is 
an example [4].

Finally, don't overlook these examples [5,6].

[1]<http://java.sun.com/docs/books/tutorial/uiswing/components/toplevel.h
tml>
[2]<http://java.sun.com/javase/6/docs/api/javax/swing/JInternalFrame.html
>
[3]<http://java.sun.com/javase/6/docs/api/javax/swing/JFrame.html>
[4]:<http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/ChartFac
tory.html>
[5]<http://java.sun.com/docs/books/tutorial/uiswing/components/internalfr
ame.html>
[6]<http://groups.google.com/group/comp.lang.java.programmer/browse_frm/t
hread/f3b21ed1083a3f75>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
0
Reply John 2/28/2010 5:26:03 PM

Thanks for the replies. I know about JInternalFrames and ideally I
would use one however the Jar (API) I am provides with only offers a
JFrame to display its contents in. I don't have the source as it is a
commercial product. So I guess I'll have to come up with some novel
idea's on my interface design so things don't look to weird.
0
Reply swebb99 2/28/2010 8:07:51 PM

On 2/28/2010 12:07 PM, swebb99@gmail.com wrote:
> Thanks for the replies. I know about JInternalFrames and ideally I
> would use one however the Jar (API) I am provides with only offers a
> JFrame to display its contents in. I don't have the source as it is a
> commercial product. So I guess I'll have to come up with some novel
> idea's on my interface design so things don't look to weird.
Here's a novel idea for you.

If it is a commercial product, make a feature request with the company :-)

Actually, that is an idea for any closed-source application.  Open 
source has a similar approach, but it is "suggest a patch" instead ;-)

-- 
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
0
Reply Daniel 2/28/2010 11:27:48 PM

4 Replies
262 Views

(page loaded in 0.205 seconds)

Similiar Articles:







7/23/2012 7:26:35 PM


Reply: