20-CS-694 Advanced Programming Techniques Spring 2012
Layouts

Interfaces, Exceptions, Graphics, Animation, Threads, Reflection, Networking, RMI, JDBC, JNI

       Previous     Next     Applet Source     All lectures

BorderLayout with Gaps

import java.awt.*;
import javax.swing.*;
import java.applet.*;

class BLGT extends JFrame {
   public BLGT () {
      setLayout(new BorderLayout(20,20));
      add("North",new JButton("North"));
      add("South",new JButton("South"));
      add("East",new JButton("East"));
      add("West",new JButton("West"));
      add("Center",new JButton("Center"));
   }
}

public class blgt extends Applet {
   BLGT b;

   public void init () {
      b = new BLGT();
      b.setSize(600,600);
      b.setVisible(true);
   }

   public void finalize () { b.dispose(); }
}