日期:2014-05-20  浏览次数:20780 次

java写教务管理系统SQL2000求高手指点
select * from tb_user where userID='a001'and password='1'
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at jdbc.DbManager.query(DbManager.java:76)
at login.Login.but1_actionPerformed(Login.java:142)
at login.Login_but1_actionAdapter.actionPerformed(Login.java:343)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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.lang.NullPointerException 空指针异常,比如有类 Test ,Test t ;(不是Test t = new Test();),然后用t去调用Test类中的方法,如t.A();这样就会出现空指针异常。
------解决方案--------------------
空指针异常Exception in thread "AWT-EventQueue-0" 
java.lang.NullPointerException
------解决方案--------------------
DbManager.java:76

把这个类贴出来看下...
------解决方案--------------------
楼主是按钮事件监听空指针异常啊,看是否少new什么与监听相关的对象啦