Writing applets

March 22, 2022 · Team EasyExamNotes · 1 min read (est.) · 0 comments

Share on WhatsApp
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.

Discussion

Ask a question, share your thoughts or report an error.

Sign in to participate in the discussion.

Join the discussion