swing 学习笔记十(边界面局管理BorderLayout)

/**
 * 边界面局管理
 * 
 * @time 2:59:38 PM
 * @author retacn yue
 * @Email zhenhuayue@sina.com
 */
public class Test_borderLayoutDemo extends Frame {
private static final long serialVersionUID = 1L;


private Test_borderLayoutDemo() {
this.setLayout(new BorderLayout());


this.add(new Button(""), BorderLayout.SOUTH);
this.add(new Button(""), BorderLayout.NORTH);
this.add(new Button(""), BorderLayout.CENTER);
this.add(new Button(""), BorderLayout.WEST);
this.add(new Button(""), BorderLayout.EAST);
}


/**
* 构造器

*/


public static void main(String[] args) {
Test_borderLayoutDemo test_borderLayoutDemo = new Test_borderLayoutDemo();
test_borderLayoutDemo.addWindowListener(new WindowAdapter() {


@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
test_borderLayoutDemo.pack();
test_borderLayoutDemo.show();
}


/**
* 窗体组件的首选大小
*/
@Override
public Dimension getPreferredSize() {
return new Dimension(300, 300);
}


}
posted @ 2012-09-08 16:35  retacn_yue  阅读(145)  评论(0编辑  收藏  举报