/* TestBorder.java CIS 160 David Klick 2011-09-24 Demonstration of BorderLayout layout manager */ import java.awt.Container; import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class TestBorder extends JFrame { public TestBorder() { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } private void createAndShowGUI() { setSize(200,200); Container c = getContentPane(); setDefaultCloseOperation(EXIT_ON_CLOSE); c.setLayout(new BorderLayout()); c.add(new JButton("Button 1"), BorderLayout.NORTH); c.add(new JButton("Button 2"), BorderLayout.EAST); c.add(new JButton("Button 3"), BorderLayout.SOUTH); c.add(new JButton("Button 4"), BorderLayout.WEST); c.add(new JButton("Button 5"), BorderLayout.CENTER); setVisible(true); } public static void main(String[] args) { TestBorder app = new TestBorder(); } }