import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.*;
public class BorderLayoutTest extends JFrame{
public static void main(String args[])
{
JFrame frame=new JFrame("边界布局管理器");
BorderLayout b=new BorderLayout();
JButton buttonEast=new JButton("东");
JButton buttonWest=new JButton("西");
JButton buttonNorth=new JButton("北");
JButton buttonSouth=new JButton("南");
JButton buttonCenter=new JButton("中");
/*将按钮放入到边界布局管理器的不同区域上*/
frame.add(buttonEast,b.EAST);
frame.add(buttonWest,b.WEST);
frame.add(buttonNorth,b.NORTH);
frame.add(buttonSouth,b.SOUTH);
frame.add(buttonCenter,b.CENTER);
frame.setBounds(400, 200, 500, 300);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
}