的努力工作,这一点在几个小时后,我很为难。 我有点新的Java和可以使用一些帮助。
堆栈跟踪:
java.lang.IllegalStateException: Component must have a valid peer
at java.awt.Component$FlipBufferStrategy.createBuffers(Unknown Source)
at java.awt.Component$FlipBufferStrategy.<init>(Unknown Source)
at java.awt.Component$FlipSubRegionBufferStrategy.<init>(Unknown Source)
at java.awt.Component.createBufferStrategy(Unknown Source)
at java.awt.Canvas.createBufferStrategy(Unknown Source)
at java.awt.Component.createBufferStrategy(Unknown Source)
at java.awt.Canvas.createBufferStrategy(Unknown Source)
at com.mime.crystalnova.Display.render(Display.java:148)
at com.mime.crystalnova.Display.run(Display.java:112)
at java.lang.Thread.run(Unknown Source)
错误似乎与这行代码在这里:
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
奇怪的是,它给我这个错误,而调试,然后继续运行完美。 当通过可运行jar文件推出,以及它工作正常。