learning java AWT 布局管理器BorderLayout

BorderLayout 将容器分为EAST, SOUTH, WEST,NORTH,CENTER五个区域。

public class BorderLayoutTest {
    public static void main(String[] args) {
        var f = new Frame("BorderLayout");
        f.setLayout(new BorderLayout());
        f.add(new Button("south"), BorderLayout.SOUTH);
        f.add(new Button("north"), BorderLayout.NORTH);
        f.add(new Button("center"));
        f.add(new Button("west"),BorderLayout.WEST);
        f.add(new Button("east"),BorderLayout.EAST);

        f.pack();
        f.setVisible(true);


    }
}

output:

posted @ 2019-07-30 10:13  嵌入式实操  阅读(234)  评论(0编辑  收藏  举报