Thursday, 13 June 2013

Applets



Java’s awt provides classes and behavior for creating graphical user interface (GUI) – based applets and applications; drawing to the screen; creating windows, menu bars, buttons, check boxes, and other GUI elements. The awt classes are part of the java.awt package.
To create applet you create a subclass of the class Applet class, part of the java.applet package, provide much of the behavior the initial applet class always has a signature like this
public class myclass extends java.applet
                                                           .Applet
{
----------
}      
Five most important methods in an applet’s execution:-
1.Initialization, 
2.Starting, 
3.Stopping, 
4.Destroying
5.Painting






INITILIZATION
The initialization of an applet might include reading and parsing any parameters to the applet, creating any helper objects it needs, setting up an initial state or loading images or fonts.
public void init ()
{
---------
}
STARTING
After an applet initialized, it is started.
public void start ()
{
-------
}
STOPPING
public void stop ()
{
---------
}
DESTROYING
Destroying enables the applet to clean up after itself just before it is freed or the browser exits.
public void destroy()
{
-------
}

PAINTING
Painting is how an applet actually draws something on the screen, be it text, a line, a colored background, or an image.
 public void pain (Graphics g)
{
-------
}
needed [import java.awt.Graphics];

No comments:

Post a Comment