单词写错了
fr.setBackground()
fr.setVisible()

解决方案 »

  1.   

    import java.awt.*;public class ExGui extends Frame
    {
    //Constructor
    public ExGui(String str)
    {
    super(str);
    }

    public static void main(String[] args)
    {
    ExGui fr=new ExGui("framewithPanel");
    Panel pan=new Panel();

    fr.setSize(400,400);
    fr.setBackground(Color.blue);
    fr.setLayout(null);
    pan.setSize(200,200);
    pan.setBackground(Color.green);

    fr.add(pan);
    fr.setVisible(true);
    }
    }