DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

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.




Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links