JAVA ERROR:AWT - nullPointerException +(mac上的游戏滞后?)

时间:2015-07-21 21:29:48

标签: java macos nullpointerexception

我的Java游戏存在问题,它在Windows计算机上运行得非常好,但在mac上确实很滞后(我已经测试了几个,所有不错的规格)。

查看控制台后,我收到nullPointerException错误!之前我从未注意到它,因为它不会影响游戏玩法!我不认为这是因为它减慢了Mac的速度,但我不太确定。

所以我猜我有两个问题..

public void keyPressed(KeyEvent key) {
    gsm.keyPressed(key.getKeyCode()); (line 120)
}

以下是控制台吐出的内容:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at KezPro.GamePanel.keyPressed(GamePanel.java:120)
at java.awt.Component.processKeyEvent(Component.java:6372)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2809)
at java.awt.Component.processEvent(Component.java:6191)
at java.awt.Container.processEvent(Container.java:2084)
at java.awt.Component.dispatchEventImpl(Component.java:4776)
at java.awt.Container.dispatchEventImpl(Container.java:2142)
at java.awt.Component.dispatchEvent(Component.java:4604)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1856)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:722)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1000)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:865)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:686)
at java.awt.Component.dispatchEventImpl(Component.java:4648)
at java.awt.Container.dispatchEventImpl(Container.java:2142)
at java.awt.Window.dispatchEventImpl(Window.java:2492)
at java.awt.Component.dispatchEvent(Component.java:4604)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:717)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:676)
at java.awt.EventQueue$2.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:690)
at java.awt.EventQueue$3.run(EventQueue.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:687)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

0 个答案:

没有答案