标签:
public class BorderLayoutPosition extends JFrame{
String[] border={BorderLayout.CENTER,BorderLayout.NORTH,BorderLayout.SOUTH,BorderLayout.EAST,BorderLayout.WEST};
String[] names={"center Button","north Button","south Button","west button","east button"};
public BorderLayoutPosition()
{
setTitle("这个窗体使用边界布局管理器");
Container c=getContentPane();
setLayout(new BorderLayout());//边界布局管理器
for (int i = 0; i < border.length; i++) {
c.add(border[i],new JButton(names[i]));
}
setSize(350, 200);
setVisible(true);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
}
public static void main(String[] args) {
new BorderLayoutPosition();
}
}
标签:
原文地址:http://www.cnblogs.com/douyunqian3520/p/5517503.html