Simple Applet
Previous    Next    Home    Source Code    Package

  1. A BorderLayout is chosen, a JTextArea is placed in the "Center", a JTextField is placed in the "South", and a JButton is placed in the "North". The textfield and textarea are initialized to "Hello World".
  2. To use an applet effectively use:
       import java.awt.*;
       import javax.swing.*;
       import java.applet.*;
    The first line should be something like this (more later):
       public class Prog1 extends Applet {
    where the public is very important and the prefix of the name of the file should match the class name.
  3. The method
       public void init () {
    is a must. The contents of this method will be invoked at startup. Thus all initializations are done here.