我在netbeans上运行此程序时遇到问题。它说,
Uncompilable source code - cannot find symbol
symbol: class Renderer
location: class Box
我知道代码运行是因为我看到我的教授在cmd上运行它,但当我尝试在netbeans上运行它时它不会让我。对不起,如果我听起来很吵,但我刚开始学习java。他下载了一个渲染文件并将其提取到cmd行。我下载了他在命令行中使用的文件,但我不知道如何将其导入netbeans。任何帮助将不胜感激!
public class Box
{
public Box()
{
x = 25;
y = 25;
width = 20;
height = 30;
rotation = 0;
name = "NONE";
visible = true;
if (canvas == null) // For drawing
canvas = new Renderer();
}
public Box(int top, int left, int w, int h, int r, String n)
{
x = left;
y = top;
width = w;
height = h;
rotation = r;
name = n;
visible = true;
if (canvas == null) // For drawing
canvas = new Renderer();
}
public void draw()
{
canvas.add(x, y, width, height, rotation, name, visible); // For drawing
canvas.render(); // For drawing
}
private int x;
private int y;
private int width;
private int height;
private int rotation;
private String name;
private boolean visible;
private static Renderer canvas; // For drawing
}
public class useBox
{
public static void main(String[] args)
{
Box amanda = new Box();
amanda.draw();
int x = 100;
int y = 100;
int width = 20;
int length = 30;
int degreesRotated = 0;
Box joe = new Box(x, y, width, length, degreesRotated, "Joe");
joe.draw();
Box meg = new Box(150, 150, 20, 30, 45, "Meg");
meg.draw();
}
}