Results 1 to 6 of 6

Thread: Confused about JApplet class

  1. #1
    Join Date
    Dec 2009
    Posts
    68

    Confused about JApplet class

    Hello Guys,

    I am beginner to the field of java programming. I have good knowledge about the VB programming, but it's totally different from java programming. The inbuilt classes of java seems very completed to know. I am getting troubled while reviewing 'JApplet class' of java language. I wonder if anyone of you provide me some details about the JApplet class of java with proper example. I am waiting for your reply.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Confused about JApplet class

    Hi,

    A JApplet class is an an extended version of java.applet.Applet that adds support for the JFC/Swing component architecture. The JApplet class is slightly incompatible with java.applet.Applet. JApplet contains a JRootPane as it's only child. The contentPane should be the parent of any children of the JApplet. This is different than java.applet.Applet. The contentPane() will always be non-null. Attempting to set it to null will cause the JApplet to throw an exception.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Confused about JApplet class

    Following example will demonstrate you the use of destroy() methods of JApplet class:
    Code:
    import javax.swing.JApplet;
    import java.awt.Graphics;
    
    public class JAppletDM extends JApplet {
      String strg1 = "";
    
      public void init() {
        strg1 += "init; ";
      }
    
      public void start() {
        strg1 += "start; ";
      }
    
      public void stop() {
        strg1 += "stop; ";
      }
    
      public void destrg1oy() {
        System.out.println("destroy");
      }
    
      public void paint(Graphics g) {
        g.drawString(strg1, 12, 25);
      }
    }

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Confused about JApplet class

    Hi friend,

    To use JApplet class of java, for that you must need review following it's methods:
    • setRootPaneCheckingEnabled(boolean bln)
    • setRootPane(JRootPane Jroot)
    • setLayout(LayoutManager LYmanager)
    • setLayeredPane(JLayeredPane layeredPn)
    • setGlassPane(Component glsPane)
    • setContentPane(Container cntPane)

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Confused about JApplet class

    Hi,

    I hope following java example will definitely solve your confusion about the JApplet class. Please copy this program and try to execute it:
    Code:
    import javax.swing.JApplet;
    import java.applet.AppletContext;
    import java.awt.Graphics;
    import java.net.URL;
    
    public class JAppMainClass extends JApplet {
    
      public void paint(Graphics gr) {
        AppletContext acV = getAppletContext();
        try {
          URL url1 = new URL("http://www.forums.techarena.in");
          acV.showDocument(url, "frame2");
        } catch (Exception e) {
          showStatus("Exception: " + e);
        }
        gr.drawString("ShowDocument Applet", 15, 25);
      }
    }

  6. #6
    Join Date
    May 2008
    Posts
    2,012

    Re: Confused about JApplet class

    I suggest you to refer following nested classes of JApplet class:
    1. JApplet.AccessibleJApplet
    2. Component.AccessibleAWTComponent
    3. Panel.AccessibleAWTPanel
    4. Component.FlipBufferStrategy
    5. Applet.AccessibleApplet

Similar Threads

  1. Confused with EventQueue class
    By Gajananvihari in forum Software Development
    Replies: 4
    Last Post: 25-02-2010, 08:25 AM
  2. Confused about JCheckBox class
    By Khan Baba in forum Software Development
    Replies: 5
    Last Post: 18-02-2010, 12:54 PM
  3. Confused with JInternalFrame class
    By Truster in forum Software Development
    Replies: 5
    Last Post: 17-02-2010, 09:58 AM
  4. Confused with JPopupMenu class
    By Bottlenecked in forum Software Development
    Replies: 5
    Last Post: 16-02-2010, 09:27 AM
  5. Confused with 'Class SpinnerNumberModel'
    By Khan Baba in forum Software Development
    Replies: 5
    Last Post: 11-02-2010, 11:08 AM

Tags for this Thread

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
  •  
Page generated in 1,714,297,246.79890 seconds with 17 queries