Search your topic here

Writing applets

WRITING  APPLETS:

An applet is a Java program written in a special format to have a graphical user interface, which allows a user to interact with a program by keyboard and mouse, or by performing other familiar actions.

The basic structure of a Java applet:

  import java.applet.Applet;
  import java.awt.*;     
  import java.awt.event.*;  
  public class AppletName extends Applet
  {
  }
THE IMPORT STATEMENTS:
import java.applet.Applet; provides the applet class.
import java.awt.*; provides button class, textbox class etc.  it is collection of classes for drawing GUI items.   
import java.awt.event.*;   provides ActionEvent, ActionListener etc.
THE CLASS DEFINITION:
public class AppletName extends Applet

Here class inherited Applet class, because some methods are taken from the class Applet. By using import java.applet.Applet; statement, Applet class was imported.

LEAVE A REPLY