Also available as BorderLayoutPlay.java

/**
 * A Simple stand-alone GUI program based on Swing.
 * The program shows how to use a BorderLayout manager
 * 
 *
 * @author Dave Hollinger
 * @version 1.0
 */

import javax.swing.*;
import java.awt.*;       // needed for Container

class BorderLayoutPlay {

  public static void main(String [] args) {
        // create a top-level container with a title
        JFrame frame = new JFrame("Border Layout Sample");

        // set the size
        frame.setSize(400,200);

        // establish what happens when the window is closed
        // (without this the program would keep running!)
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // grab the content container associated with the frame.
        Container c = frame.getContentPane();

        // add a label at the top
        c.add(new JLabel("NORTH",JLabel.CENTER),BorderLayout.NORTH);

        // add a label at the bottom
        c.add(new JLabel("SOUTH",JLabel.CENTER),BorderLayout.SOUTH);

        // add a button on the left
        c.add(new JButton("WEST"),BorderLayout.WEST);

        // add a button on the right
        c.add(new JButton("EAST"),BorderLayout.EAST);

        // add a button in the center
        c.add(new JButton("CENTER"),BorderLayout.CENTER);


        // make the frame visible
        frame.setVisible(true);
  }



}