Java错误:找不到符号

时间:2014-12-07 04:19:11

标签: java

好的,所以我有这个程序,我从我的导师那里复制了

import acm.program.*;
public class GRectPlusGOval extends GraphicsProgram {
   public void run() {
      GRect rect = new GRect(100, 50, 125, 60);
      rect.setFilled(true);
      rect.setColor(Color.RED);
      add(rect);
      GOval oval = new GOval(100, 50, 125, 60);
      oval.setFilled(true);
      oval.setFillColor(Color.GREEN);
      add(oval);
   }
}

当我尝试编译它时,我收到了这条消息:

grectplusgoval.java:4: error: cannot find symbol
GRect rect = new GRect(100,50,125,60);
^
symbol:class GRect
location:class GRectPlusGOval

grectplusgoval.java:4: error: cannot find symbol
GRect rect = new GRect(100,50,125,60);
                 ^
symbol:class GRect
location:class GRectPlusGOval

grectplusgoval.java:6: error: cannot find symbol
rect.setColor(Color.RED);
               ^
symbol:variable Color
location:class GRectPlusGOval

grectplusgoval.java:8: error: cannot find symbol
GOval oval = new GOval(100,50,125,60)
^                
symbol:class GOval
location:class GRectPlusGOval

grectplusgoval.java:8: error: cannot find symbol
GOval oval = new GOval(100,50,125,60)
                 ^
symbol:class GOval
location:class GRectPlusGOval

grectplusgoval.java:10: error: cannot find symbol
oval.setFillColor(Color.GREEN);
                  ^
symbol: variable Color
location:class GRectPlusGOval
6 errors

出了什么问题,如何更正?

1 个答案:

答案 0 :(得分:0)

您需要找到ac.graphics.*个包裹。您的项目中缺少此包。