TestMulitFrame

//TestMultiFrame.java
import java.awt.*;

public class TestMulitFrame{
public static void main(String[] args){
new MyFrame(100,100,100,100,Color.yellow);
new MyFrame(100,200,100,100,Color.green);
new MyFrame(200,100,100,100,Color.blue);
new MyFrame(200,200,100,100,Color.red);
}
}

class MyFrame extends Frame{
static int id=0;
MyFrame(int x,int y,int w,int h,Color color){
super("Frame : "+ (id++));
setBackground(color);
setLayout(null);
setBounds(x,y,w,h);
setVisible(true);
}
}

运行效果:

posted on 2017-05-21 19:26  Iitb  阅读(106)  评论(0)    收藏  举报

导航