一段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){}
}
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){}
}
解决方案 »
- swing 皮肤包问题
- 老鸟看过来:java怎么编译成可执行性文件?
- JB里我写的一个类文件,JB经常自动找不着?
- 能否让一个虚拟机实例里的运行的应用程序所调用的类运行在另一个虚拟机实例里?
- 这个程序有问题啦!!!
- 菜鸟的问题:怎么能看到小应用程序的源代码啊?新手上路!
- 关于Context 类的问题
- 新手请教!关于swing的问题
- 矛盾中,想听听各位的意见,参与有分
- 异常信息:java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
- 关于String.intern()的问题
- OJB的debug选项
applet8=(Applet)getAppletContext().getApplet("applet8");然后 applet8好象没有moveLable这个方法不知道干什么的。
moveLabel
下面是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)
就是方法没有定义估计是写掉了
改成 Applet8 applet8;试试