当我运行这个程序时:
import javax.swing.*;
import java.awt.*;
public class DrawApplet extends JApplet{
public void init () {
Container content_pane = getContentPane ();
// Create an instance of DrawingPanel
int x=1000, y=1000;
content_pane.setSize(x, y);
// And add the DrawingPanel to the content pane.
main_panel drawing_panel = new main_panel(x,y);
content_pane.add(drawing_panel);
}
}
显示错误:
DrawApplet.java:16: error: cannot find symbol
main_panel drawing_panel = new main_panel(x,y);
^
symbol: class main_panel
location: class DrawApplet
DrawApplet.java:16: error: cannot find symbol
main_panel drawing_panel = new main_panel(x,y);
^
symbol: class main_panel
location: class DrawApplet
2 errors
答案 0 :(得分:0)
my
是您创建的课程吗?如果是这样,它不遵循典型的命名标准 - 因为类应以大写字母开头。它在类路径上吗?
此外,您的错误与您发布的代码(my
与main_panel
)不符。确保您的文件和构建是最新的。