- import java.awt.*;
- public class FramePanel extends Frame{
- public FramePanel(String str){
- super(str);
- }
- public static void main(String args[]){
- FramePanel fr=new FramePanel("Frame with Panel");
- Panel pan=new Panel();
- fr.setSize(300,200);
- fr.setBackground(Color.blue);
- fr.setLayout(null);
- pan.setSize(100,100);
- pan.setBackground(color.yellow);
- fr.add(pan);
- fr.setVisible(true);
- }
- }
复制代码 运行javac 提示Class FramePanel is public, should be declared in a file name .... |
|