工作中遇到一个上传组件,需要用到窗口程序开发一个桌面小程序,使用的java的Swing来写,中间遇到一个奇怪的问题
- place custom component creation code here
- 程序一直运行到createUIComponents()处,而不是构造函数处。
Connected to the target VM, address: '127.0.0.1:37558', transport: 'socket'
Exception in thread "main" java.lang.NullPointerException
at com.mumudas.testSwing.TestGuiForm.$$$setupUI$$$(TestGuiForm.java)
at com.mumudas.testSwing.TestGuiForm.<init>(TestGuiForm.java:26)
at com.mumudas.testSwing.TestGuiForm.main(TestGuiForm.java:42)
Disconnected from the target VM, address: '127.0.0.1:37558', transport: 'socket'
Process finished with exit code 1
一直报错空指针异常。调试发现实在new过程中出问题
程序直接运行到
private void createUIComponents() {
// TODO: place custom component creation code here
}
原因出在我们在创建某个组件的时候,误点了custom Creat
取消选中重新执行,就不报错了。