An applet skeleton contains four main methods - init(), start(), stop(), and destroy(). The init() method initializes the applet, start() runs the applet, stop() pauses the applet, and destroy() removes the applet from memory. To test an applet, you can run it via an HTML file or the appletViewer tool by compiling the Java file and using appletviewer to run the applet class.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100%(1)100% found this document useful (1 vote)
2K views
What Is An Applet Skeleton
An applet skeleton contains four main methods - init(), start(), stop(), and destroy(). The init() method initializes the applet, start() runs the applet, stop() pauses the applet, and destroy() removes the applet from memory. To test an applet, you can run it via an HTML file or the appletViewer tool by compiling the Java file and using appletviewer to run the applet class.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
What is an Applet Skeleton?
How do you test( Compile and
run) your applet in java
ANS) The Applet skeleton is formed of four method
namely The init () method- It is called the first time an applet is loaded into the memory of computer. We can initialize variables to the applet in the init() method. The start () method-This method is called immediately after init() and this is used for restarting a process . The stop () method-It is called when applet loses focus .It is used to reset variables and stop threads. The destroy () method-It is called by the browser when the user moves to another page. This helps in closing the file like operations . destroy() method is called when your applet needs to be removed completely from memory.
Thus ,init () initializes the applet . start() makes the applet
run. stop() stops the applet and applet gets destroyed by destroy()
There are two ways to run an applet
1. By html file. 2. By appletViewer tool (for testing purpose).
For running the applet ,first in cmd we write
1)javac filename.java 2)appletviewer classname CODE: import java.applet.*; public class AppletTest extends Applet { public void init() { //initialization } public void start () { //start or resume execution } public void stop() { //suspend execution { public void destroy() { //perform shutdown activity } public void paint (Graphics g) { //display the content of window } } TO COMPILE : javac AppletTest.java TO RUN: appletviewer AppletTest