所以我对 libgdx 非常陌生,我正在做 libgdx wiki 上的 drop 教程。所以当我完成后,我在 Iterator<Rectangle> iter = raindrops.iterator();
第 98 行出现错误。
更具体地说:
The type HTMLDocument.iterator is not genetic; it cannot be parameterized with arguments
<Rectangle>
也在控制台中我得到了这个:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.Error: Unresolved compilation problem:
The type HTMLDocument.Iterator is not generic; it cannot be parameterized with arguments <Rectangle>
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: java.lang.Error: Unresolved compilation problem:
The type HTMLDocument.Iterator is not generic; it cannot be parameterized with arguments <Rectangle>
at com.mygdx.test.Test.render(Test.java:98)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:206)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
我真的不知道为什么我会收到此错误,如果您知道解决方案,我将非常感谢您的帮助。感谢您抽出时间。
最佳答案
看来您不小心添加了错误的导入!
您需要导入:
import java.util.Iterator;
而不是:
import javax.swing.text.html.HTMLDocument.Iterator;
因为 HTMLDocument.Iterator
类在 libgdx drop tutorial 中根本没有使用
关于java - Libgdx游戏制作教程(Drop)Iterator<Rectangle>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25527986/