马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 帅雷必成c王 于 2022-5-30 16:01 编辑 package com.LyqStudy.lesson01;
import java.awt.*;
public class TestPractice {
public static void main(String[] args) {
Frame frame = new Frame("Practice");
frame.setVisible(true);
frame.setLocation(400,300);
frame.setLayout(new GridLayout(2,1));
frame.setSize(300,400);
frame.setBackground(Color.blue);
//4个面板
Panel p1 = new Panel(new BorderLayout());
Panel p2 = new Panel(new GridLayout(2,1));
Panel p3 = new Panel(new BorderLayout());
Panel p4 = new Panel(new GridLayout(2,2));
//上面
p1.add(new Button("East"),BorderLayout.EAST);
p1.add(new Button("West"),BorderLayout.WEST);
p2.add(new Button("P2-btn-1"));
p2.add(new Button("p2-btn-2"));
p1.add(p2,BorderLayout.CENTER);
//下面
p3.add(new Button("East-2"),BorderLayout.EAST);
p3.add(new Button("West-2"),BorderLayout.WEST);
//中间4个
for (int i = 0; i <4; i++) {
p4.add(new Button("p4-brn-"+i));
}
p3.add(p4,BorderLayout.CENTER);
}
}
重新截了个图
|