Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/385.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java netbeans的渲染问题_Java_Netbeans_Rendering - Fatal编程技术网

Java netbeans的渲染问题

Java netbeans的渲染问题,java,netbeans,rendering,Java,Netbeans,Rendering,在netbeans上运行此程序时遇到问题。上面说, Uncompilable source code - cannot find symbol symbol: class Renderer location: class Box 我知道代码在运行,因为我看到我的教授在cmd上运行它,但当我尝试在netbeans上运行它时,它不允许我运行。对不起,如果我听起来很粗鲁,但我刚刚开始学习java。他下载了一个渲染文件,并在cmd行上提取了它。我下载了他在命令行上使用的文件,但我不知道如何

在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();
}
}

这个错误告诉您到底出了什么问题——您试图使用Java找不到的类、渲染器和Box。NetBeans帮助将告诉您如何让NetBeans将这些类添加到项目的构建路径中,然后有希望让您的代码运行。顺便说一句,您的代码没有任何缩进,这使得它完全正确,几乎无法阅读、理解和调试。请重新格式化您发布的代码,给它适当的缩进,通常每个块4个空格,并确保同一块上的所有代码都在相同的缩进级别。我们将非常感谢您在这方面的合作,这将有助于您获得及时、体面的答复。