DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: applet

  1. #1
    Join Date
    Jul 2005


    import java.awt.*;
    import java.applet.Applet;

    public class applet1 extends Applet
    String m;

    public void init()
    m = "hello world";

    public void start()


    public void paint(Graphics g)

    The init() method used in the java applet is simular to the contructor defined in a java application. The purpose of the init() method is to initialize a variable. This method is first called by the browser and it's a one time operation.

    Once the init() method is invoked then the browser will call the start() method automatically. The start() method is used to start a thread as an example. The start() method is invoked each time it losses and gain focus.

    Then the paint() method is invoked. The purpose of the paint() method is to draw itself. There are two ways in which this paint() method can be triggered.
    1. System triggered painting
    - Invoked by the awt.
    2. Application triggered painting
    - Invoked by using the repaint() method.

    1. Why is it that without defining the init() and the start() method, the paint() method can still be invoked? Is it because the paint() method is triggered by the environment?.
    Last edited by solomon_13000; 06-23-2009 at 09:54 AM.

Similar Threads

  1. Serious problem with a website!
    By Loham in forum Java
    Replies: 1
    Last Post: 06-13-2008, 08:11 AM
  2. JavaMail applet problem
    By Tataroz T. in forum Java
    Replies: 1
    Last Post: 10-20-2005, 06:19 AM
  3. Bouncing Ball Applet
    By nescafe in forum Java
    Replies: 1
    Last Post: 10-07-2005, 08:51 AM
  4. Replies: 3
    Last Post: 08-23-2001, 11:01 AM
  5. Replies: 0
    Last Post: 03-28-2000, 01:52 AM

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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

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