Convert JApplet to Applet...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Convert JApplet to Applet...

Hybrid View

  1. #1
    Chris L. Guest

    Convert JApplet to Applet...


    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.

  2. #2
    Paul Clapham Guest

    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.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center