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 show the use of Switch Statement

  2. 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

  3. Even no or Prime no?????

  4. Program of UDP news server

  5. Program for Thread Priority

  6. Program to print a string on Standard Output Device

  7. An applet program to display alternate filled and empty circle that to in row and column format

  8. Program to show the use of Bitwise Operator (&) AND

  9. Program to show the use of Bitwise Operator (|) OR

  10. Program to show the comparing of Strings for equality

  11. Program to show an example of searching Strings for subStrings

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

  13. Program which calls the method sort(int []a) which throws the Exception ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException

  14. Program of concatenating and Buffering files

  15. Program of bubble sort

  16. Pass the marks of 10 students from the client side design a servlet, which takes these marks and returns the number of students who obtained first cls

  17. Corba program of UDP client server application which sends the news to the client. Server takes the news from the NewsDataFile located at the server

  18. Biological Sequence Allignment Using Dynamic Programing

  19. Corba program to develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side

  20. Program to make directory

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