Step 1

The first step is to build the basic framework for the user interface. In the discussion that follows, we will build the interface as a separate window, rather than as a panel contained within the applet window.


import java.applet.Applet;
import java.awt.*;

public class step1 extends Applet{
// provides separate window for ui components 

Frame outerBox = new Frame ( );
Panel topPanel = new Panel ( ); 
Panel centerPanel = new Panel ( ); 
Panel bottomPanel = new Panel ( );

  public void init ( ){ 
    topPanel . setBackground (Color.red);
    centerPanel . setBackground (Color.white);
    bottomPanel . setBackground (Color.blue);
    outerBox. setLayout (new BorderLayout ( ) );
    outerBox.add ("North", topPanel);
    outerBox.add ("Center", centerPanel);
    outerBox.add ("South", bottomPanel);
    outerBox.resize (600, 500);
    outerBox. setBackground (Color.white);
    outerBox.show( );
} // end init

}// end step1 

Run the applet