TestPanel

//TestPanel.java

import java.awt.*;

public class TestPanel{
public static void main(String[] args){
Frame f=new Frame("Java Frame with Panle");
Panel p=new Panel(null);
f.setLayout(null);
f.setBounds(300,300,500,500);
f.setBackground(Color.white);
p.setBounds(50,50,400,400);
p.setBackground(Color.red);
f.add(p);
f.setVisible(true);
}
}

运行效果:

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

导航