File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes calling JFrame in JApplet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "calling JFrame in JApplet" Watch "calling JFrame in JApplet" New topic

calling JFrame in JApplet

Beena Thomas

Joined: Sep 26, 2001
Posts: 5
Is it possible to call a JFrame inside a JApplet and how is it.
When i tried it is showing java.lang.IllegalArgumentException: adding a window to a container.

Can anyone help me with this
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Beena,
Yes you can create a new JFrame from within a JApplet.

Will do it. However, your error seems to relate to you trying to place a Frame into an Applet. This is not allowed because an Applet is a container while a Frame is a window. If you just want a container inside an APplet then you should use a Panel.
Beena Thomas

Joined: Sep 26, 2001
Posts: 5
Thanks Manfred.
If that is the case is it possible to use an instance of JPanel having a JFileChooser added to its contentpane get displayed in a JApplet.
I would appreciate your response
I agree. Here's the link:
subject: calling JFrame in JApplet
It's not a secret anymore!