Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
本人遇到了标题所述的问题:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at userinterface.userinterframe.exit(userinterframe.java:184)
at userinterface.userinterframe.processWindowEvent userinterframe.java:235)
。。。。。。
这是第184行的: Component[] components = contentPane.getComponents();
contentPane初始是这样的:contentPane = (JPanel) this.getContentPane();
这是第235行的:protected void processWindowEvent(WindowEvent e) {
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
exit();
}
}
网上也有相关的提问:回答的一般是,控制指针错误,控制操作,有个空指针什么的,本人不太明白,请高手给点详细的提示。