该程序在java中工作正常,我更改了数组以适应groovy的API,但它仍然无法在groovy中工作。错误似乎在我的Cube3D和MyBox3D类中,特别是构造函数。您能否帮助找到此错误的来源以及如何纠正错误。这是我的第一个groovy程序,第一次在这里发帖,所以我可能会遗漏一些明显的东西。我把两个构造函数放在一边给我带来麻烦。
错误讯息是....
线程中的异常&#34; main&#34; groovy.lang.GroovyRuntimeException:找不到匹配的构造函数:org.Cube.MyBox3D(java.util.ArrayList,java.util.ArrayList,java.util.ArrayList,java.awt.Color,java.lang.Boolean)< / p>
头等舱
package org.Cube;
import java.awt.Color;
import org.Cube.MyBox3D;
import org.Cube.*;
public class Cube3D {
double x, y, z, width, length, height, rotation = Math.PI*0.75;
double[] RotAdd = [4];
Color c;
double x1, x2, x3, x4, y1, y2, y3, y4;
MyBox3D[] bx = new MyBox3D[6];
double[] angle;
public Cube3D(double x, double y, double z, double width, double length, double height, Color c)
{
//Error here with reading in constructor
bx[0] = new MyBox3D([x, x+width, x+width, x], [y, y, y+length, y+length], [z, z, z, z], c, false);
Screen.Boxes3D.add(bx[0]);
bx[1] = new MyBox3D([x, x+width, x+width, x], [y, y, y+length, y+length], [z+height, z+height, z+height, z+height], c,false);
Screen.Boxes3D.add(bx[1]);
bx[2] = new MyBox3D([x, x, x+width, x+width],[y, y, y, y], [z, z+height, z+height, z], c,false);
Screen.Boxes3D.add(bx[2]);
bx[3] = new MyBox3D([x+width, x+width, x+width, x+width], [y, y, y+length, y+length], [z, z+height, z+height, z], c,false);
Screen.Boxes3D.add(bx[3]);
bx[4] = new MyBox3D([x, x, x+width, x+width],[y+length, y+length, y+length, y+length], [z, z+height, z+height, z], c,false);
Screen.Boxes3D.add(bx[4]);
bx[5] = new MyBox3D([x, x, x, x], [y, y, y+length, y+length], [z, z+height, z+height, z], c,false);
Screen.Boxes3D.add(bx[5]);
this.c = c;
this.x = x;
this.y = y;
this.z = z;
this.width = width;
this.length = length;
this.height = height;
setRotAdd();
updatePoly();
}
第二课
package org.Cube;
import java.awt.Color;
import org.Cube.*;
public class MyBox3D {
Color c;
double[] x, y, z;
boolean draw = true, seeThrough = false;
double[] CalcPos, newX, newY;
Box3DObject DrawablePolygon;
double AvgDist;
MyBox3D()
{
}
MyBox3D(double[] x, double[] y, double[] z, Color c, boolean seeThrough)
{
this.x = x;
this.y = y;
this.z = z;
this.c = c;
this.seeThrough = seeThrough;
createPolygon();
}