1 import java.applet.Applet; 2 import java.awt.*; 3 4 public class BorderLayout1 extends Applet { 5 Button EastButton, WestButton, NorthButton, SouthButton, CenterButton; 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 CenterButton = new Button("Center"); 14 15 /* setting layout to BorderLayout 16 with horizontal and vertical spacing of 10 pixels */ 17 setLayout(new BorderLayout(10,10)); 18 19 // order is not important here as we are specifying the positions 20 add("East", EastButton); 21 add("West", WestButton); 22 add("North", NorthButton); 23 add("South", SouthButton); 24 add("Center", CenterButton); 25 } 26 } 27