我正在为 AP 计算机科学决赛制作计算器。我使用 Jigloo 在 Eclipse 中构建了 GUI,并且我很快尝试了解 Action Listeners,以便您可以点击按钮来显示数字。当我开始输入实际代码进行计算时,问题就开始出现了。我不断收到以下错误:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at NewJFrame.<init>(NewJFrame.java:82)
at NewJFrame$1.run(NewJFrame.java:73)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
我对 Java 很陌生,而且我以前从未尝试过这样的项目。如果你们能帮我解决这个问题,我会很高兴。这是我的实际代码的链接,由于某种原因它不适合代码框:链接到代码