package GUi;
import java.awt.*;
public class GuI2 {
public static void main(String[] args) {
MyFrame new1 = new MyFrame(100,100,300,100,Color.BLUE);
MyFrame new2 = new MyFrame(220,300,300,100,Color.green);
MyFrame new3 = new MyFrame(330,500,300,100,Color.yellow);
MyFrame new4 =new MyFrame(440,700,300,100,Color.red);
}
}
class MyFrame extends Frame {
// 计数器
static int id = 0;
public MyFrame(int x,int y,int w,int h,Color color){
super("窗口+"+(++id));
setVisible(true);
// 大小
setBounds(x,y,w,h);
// 设置背景
setBackground(color);
}
}