我对IntelliJ GUI-Builder有问题。在IntelliJ中创建了一个简单的GUI表单并为JPanel
生成了一个吸气剂之后。尝试将NullPointerException
添加到JPanel
时,只会得到JFrame
。
我已经尝试安装Java 8而不是10。此外,我还尝试更改设置以生成源代码而不是字节码,但这没有用。
SwingUtilities.invokeLater(() -> {
JFrame meinFrame = new JFrame("JavaDate.exe stopped working");
meinFrame.setVisible(true);
meinFrame.setSize(720,720);
meinFrame.add(new JAVADATE().getField()); //ERROR
meinFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
});
我希望看到JPanel
的内容,但在上面标记的行中只有NullPointerException
。
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.awt.Container.addImpl(Container.java:1095)
at java.awt.Container.add(Container.java:1007)
at javax.swing.JFrame.addImpl(JFrame.java:567)
at java.awt.Container.add(Container.java:419)
at MyCalendar.lambda$run$0(MyCalendar.java:16)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)