I've run into a problem converting my application into an applet. My original
application was written using the swing classes. In the app I placed my buttons,
textfields, labels, and textarea in a Container set equal to getContentPane().
I can't seem to find the 'equivalent' of a getContentPane() method like the
one in the JFrame swing component.

Any help would be great.
Thanks,
Chris L.

05-10-2000, 05:43 PM

Paul Clapham

Re: Convert JApplet to Applet...

<Chris L.> wrote in message news:39199d1b$1@news.devx.com...
>
> I've run into a problem converting my application into an applet. My
original
> application was written using the swing classes. In the app I placed my
buttons,
> textfields, labels, and textarea in a Container set equal to
getContentPane().
> I can't seem to find the 'equivalent' of a getContentPane() method like
the
> one in the JFrame swing component.
>
> Any help would be great.
> Thanks,
> Chris L.

Copied from the Java documentation for class JFrame:

<<<start copy>>>
The JFrame class is slightly incompatible with java.awt.Frame. JFrame
contains a JRootPane as it's only child. The contentPane should be the
parent of any
children of the JFrame. This is different than java.awt.Frame, e.g. to add a
child to an AWT Frame you'd write:

frame.add(child);

However using JFrame you need to add the child to the JFrames contentPane
instead:

frame.getContentPane().add(child);
<<<end copy>>>

So it looks like you just add your components directly to the Frame without
using an intermediary object.