Java Tutorial

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

public class LifeCycle extends Applet
{
      private static int initcall, startcall, paintcall, stopcall, destroycall;

      public void init()
      {
          setBackground(Color.cyan);
          setForeground(Color.red);
          initcall=initcall+1;
      }

      public void start()
      {
           startcall=startcall+1;
      }

      public void paint(Graphics g)
      {
              paintcall=paintcall+1;
              g.drawString(\"init Method is called for  : \"+initcall,0,14);
              g.drawString(\"start Method is called for  : \"+startcall,0,30);
              g.drawString(\"paint Method is called for : \"+paintcall,0,46);
              g.drawString(\"stop Method is called for : \"+stopcall,0,62);
              g.drawString(\"destroy Method is called for : \"+destroycall,0,78);
              showStatus(\"Demo of Applet Life Cycle\");
     }

     public void stop()
     {
            stopcall=stopcall+1;
     }

     public void destroy()
     {
            destroycall=destroycall+1;
     }
}

    Related Post:
  1. Program to read the price of an item in decimal form (like 75.95) and print the output in paise (like 7595 paise).

  2. Program of creating a file using text fields in windows

  3. GUI application in java, which enter the details of a student and on the submit display the details of the student

  4. An applet program to draw Polygon Graph with given data

  5. Program of Floyds Triangle

  6. Program to show an example of creating a String object from a StringBuffer Object

  7. File handling program to copy bytes from one file to another

  8. An applet program that displays random dot

  9. Program to show the use of some Character Methods

  10. Program to sort the contents of an array using Bubble Sort

  11. Program using Switch case to compute the net amount to be paid by a customer

  12. Program that takes a long sentence and a character from the client and count the occurrence of the character in the sentence at the server side

  13. Program to reverse the number eg given no : - 12345, output want :- 54321

  14. Program, which creates a three thread. One thread display the numbers from 1 to 5, second thread display the square root of that number etc

  15. An applet program that concatenates two string entered in TextField

  16. Program to find a factorial of a given number

  17. Develop a game application in CORBA for which the player will guess a number between 1 to 100, which will be compared to the random number generated b

  18. Program to show the use of Increment and Decrement Operators

  19. Program of storing and retrieving integers using data streams on a single file

  20. Program that will read real number from the keyboard and print the following output in one line: small Integer not less The Given Number Largest Int

 
 
Didn't find what you were looking for? Find more on Simple Applet which will show life cycle of an Applet