An Applet - BorderLayout

Previous     Next     Applet     Java Source

   import java.awt.*;          // For the BorderLayout class
   import javax.swing.*;       // For the JButton class
   import java.applet.*        // For the Applet class

   public class Prog1 extends Applet {
      JButton n,s,e,w,c;

      public void init () {
         setLayout(new BorderLayout());
         add ("North",  n = new JButton("North Button"));
         add ("South",  s = new JButton("South Button"));
         add ("East",   e = new JButton("East Button"));
         add ("West",   w = new JButton("West Button"));
         add ("Center", c = new JButton("Hello World"));
      }
   }