一段Applet,为什么不能通过编译,提示
Applet8_Controller.java:15: 找不到符号
符号: 方法 moveLabel(int,int)
位置: 类 java.applet.Applet
applet8.moveLabel(me.getX(),me.getY());
       ^
1 错误
xxxxxxxxxxxxxxxxxxxximport java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Applet8_Controller extends Applet implements MouseMotionListener{
Applet applet8;
public void init(){
addMouseMotionListener(this);
setBackground(Color.red);
}
public void mouseMoved(MouseEvent me){
if(applet8==null){
applet8=(Applet8)getAppletContext().getApplet("applet8");
}applet8.moveLabel(me.getX(),me.getY());}
public void mouseDragged(MouseEvent me){}
}

解决方案 »

  1.   

    用个IDE吧
    applet8=(Applet)getAppletContext().getApplet("applet8");然后 applet8好象没有moveLable这个方法不知道干什么的。
      

  2.   

    applet 里有这个方法吗?
    moveLabel
      

  3.   

    applet8=(Applet8)getAppletContext().getApplet("applet8"); 对于moveLabel也没见过!
      

  4.   

    没有moveLabel(int,int)这个方法,应该是move(int ,int).
    下面是API中的说明。move
    @Deprecated
    public void move(int x,  int y)Deprecated. As of JDK version 1.1, replaced by setLocation(int, int). 
    --------------------------------------------------------------------------------setLocation
    public void setLocation(Point p)Moves this component to a new location. The top-left corner of the new location is specified by point p. Point p is given in the parent's coordinate space. Parameters:
    p - the point defining the top-left corner of the new location, given in the coordinate space of this component's parent
    Since: 
    JDK1.1 
    See Also:
    getLocation(), setBounds(int, int, int, int)
      

  5.   

    (Applet) getAppletContext().getApplet("applet8");eclipse中显示applet8中没有moveLabel方法.是不是还有代码没帖全.
      

  6.   

    写的很清楚
    就是方法没有定义估计是写掉了
    改成 Applet8   applet8;试试