The Applet class is contained in the java.applet package. Applet contains several methods that give detailed control over the execution of applet.
Applet extends the AWT class Panel. In turn, Panel extends Container, which extends Component. These classes provide support for Java’s window-based, graphical interface. Thus, Applet provides all of the necessary support for window-based activities.
The following figure shows the Applet class hierarchy.
In addition,java.applet also defines three interfaces:
AppletContext, AudioClip, and AppletStub.
Methods of Applet class
void destroy( )
This method is Called by the browser just before an applet is terminated. Your applet will override this method if it needs to perform any cleanup prior to its destruction.
AppletContext getAppletContext( )
This method returns the context associated with the applet.
String getAppletInfo( )
This method returns a string that describes the applet.
String getParameter(String paramName)
This method returns the parameter associated with paramName. null is returned if the specified parameter is not found.
void init( )
This method is called when an applet begins execution. It is the first method called for any applet.
boolean isActive( )
This method returns true if the applet has been started. It returns false if the applet has been stopped.
void resize(Dimension dim)
This method resizes the applet according to the dimensions specified by dim. Dimension is a class stored inside java.awt. It contains two integer fields: width and height.
void resize(int width, int height)
This method resizes the applet according to the dimensions specified by width and height.
void start( )
This method is called by the browser when an applet should start (or resume) execution. It is automatically called after init( ) when an applet first begins.
void stop( )
This method is called by the browser to suspend execution of the applet. Once stopped, an applet is restarted when the browser calls start( ).
Posted by : Ruchita Pandya
No comments:
Post a Comment