1  import java.applet.Applet;
  2  import java.awt.*;
  3  
  4  public class BorderLayout2 extends Applet {
  5    Button EastButton, WestButton, NorthButton, SouthButton;
  6  
  7    public void init() {
  8      // instantiating the button objects
  9      EastButton = new Button("East");
 10      WestButton = new Button("West");
 11      NorthButton = new Button("North");
 12      SouthButton = new Button("South");
 13  
 14      /* setting layout to BorderLayout 
 15         with horizontal and vertical spacing of 10 pixels */
 16      setLayout(new BorderLayout(10,10));
 17      
 18      // order is not important here as we are specifying the positions
 19      add("East", EastButton);
 20      add("West", WestButton);
 21      add("North", NorthButton);
 22      add("South", SouthButton);
 23    }
 24  }
 25