chevron_left
64 points
10 5 2

Init()
The init( ) method is the first method to be called. This is where you should initialize variables. This method is called only once during the run time of your applet.

Start()
The start( ) method is called after init( ). It is also called to restart an applet after it has been stopped. Whereas init( ) is called once—the first time an applet is loaded—start( ) is called each time an applet’s HTML document is displayed onscreen. So, if a user leaves a web page and comes back, the applet resumes execution at start( ).

Paint()
The paint( ) method is called each time your applet’s output must be redrawn. This situation can occur for several reasons. For example, the window in which the applet is running may be overwritten by another window and then uncovered. Or the applet window may be minimized and then restored. paint( ) is also called when the applet begins execution.

Whatever the cause, whenever the applet must redraw its output, paint( ) is called. The paint( ) method has one parameter of type Graphics. This parameter will contain the graphics context, which describes the graphics environment in which the applet is running. This context is used whenever output to the applet is required.

Stop()
The stop( ) method is called when a web browser leaves the HTML document containing the applet—when it goes to another page, for example. When stop( ) is called, the applet is probably running. You should use stop( ) to suspend threads that don’t need to run when the applet is not visible. You can restart them when start( ) is called if the user returns to the page.

Destroy()
The destroy( ) method is called when the environment determines that your applet needs to be removed completely from memory. At this point, you should free up any resources the applet may be using. The stop( ) method is always called before destroy( ).

More Posts

Java’s Applet Skeleton Takele - Oct 11
Run an applet program in java usmanhashmi - Aug 11
Which of the following tags are no longer valid in html 5? Tushar Shuvro - Apr 24, 2020
Declaration, Instantiation and Initialization of Java Array muliemes - May 18
Error occurred during initialization of boot layer. Hasnain_khan - Oct 12, 2020
Error occurred during initialization of VM Hasnain_khan - Oct 10, 2020
An error occurred during initialization of VM Could not reserve enough space for 2097152kb object heap. Farkhanda Athar - Aug 3, 2020
Write a program that squares an integer and prints the result. Naymul01 - 1 day
Class is not abstract and does not override abstract method Naymul01 - 1 day
Write a program that finds the sum of all squares between 1 and 100 Naymul01 - 3 days