我创建了一个带有属性的类Color
。
public class CurveParticle {
private Circle c;
private boolean collidable;
private Color color;
public CurveParticle(Circle c, boolean coll){
this.c = c;
this.collidable = coll;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = new Color(color);
}
}
颜色来自进口com.badlogic.gdx.graphics.Color
。
每当我尝试使用 setter 方法设置颜色,甚至将颜色传递给构造函数时(我已在此示例中删除了参数),它都会给我这种异常:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchMethodError: com.me.Kurve.CurveParticle.setColor(Lcom/badlogic/gdx/graphics/Color;)V
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: java.lang.NoSuchMethodError: com.me.Kurve.CurveParticle.setColor(Lcom/badlogic/gdx/graphics/Color;)V
at com.me.Kurve.Kurve.show(Kurve.java:67)
at com.badlogic.gdx.Game.setScreen(Game.java:62)
at com.me.Screens.EnterGame.create(EnterGame.java:12)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
我应该而不是传递一个浮点数组或其他东西。这真的很奇怪,因为没有颜色参数一切正常。我不认为我应该受到责备,不是吗?