`

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);
}


}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics