import java.awt.*;
import javax.swing.*;
public class BorderLayoutManagerExample  extends JFrame {

	public BorderLayoutManagerExample (String title) {
    	super(title);
    	
        // the JFrame already has a border layout by default, but
		// by doing this, we also get to specify a 2 pixel gap (i.e.,
		// margin) between components.
		setLayout(new BorderLayout(2,2));

        add(BorderLayout.NORTH, new JButton("North"));
        add(BorderLayout.SOUTH, new JButton("South"));
        add(BorderLayout.EAST, new JButton("East"));
        add(BorderLayout.WEST, new JButton("West", new ImageIcon("brain.gif")));
        add(BorderLayout.CENTER, new PanelWithFourComponents());
        
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(500, 300);
	}
	
	public static void main(String args[]) {
    	BorderLayoutManagerExample frame = new BorderLayoutManagerExample("Border Layout Example");
        frame.setVisible(true);
	}
}