|
我zhi要点登录窗kou按扭,执行以下代碼
public void jBlogin_actionPerformed(ActionEvent e) {
String pass = null;
pass = String.valueOf(jPasswordField1.getPassword());
String sqlSelect = null;
sqlSelect = "select count(*) from tb_user where userid = '" + jTextField1.getText().trim()
+ "' and pass = '" + pass + "'";
java.util.Vector vdata = null;
appstu.util.RetrieveObject retrieve = new appstu.util.RetrieveObject();
vdata = retrieve.getObjectRow(sqlSelect);
System.out.println(vdata.size() + " : " + vdata.get(0));
if (Integer.parseInt(String.valueOf(vdata.get(0))) > 0){
AppMain frame = new AppMain();
this.setVisible(false);
}else{
javax.swing.JOptionPane.showMessageDialog(null, "輸入的kou令bu正确,请重新shu入!!!", "系tong提示",
javax.swing.JOptionPane.ERROR_MESSAGE);
jPasswordField1.requestFocus();
return;
}
}
}
就会出錯!我只要把与java.util.Vector vdata = null;
相关的刪chu了jiu没有问题了!比如把java.util.Vector vdata = null;
appstu.util.RetrieveObject();
vdata = retrieve.getObjectRow(sqlSelect);
System.out.println(vdata.size() + " : " + vdata.get(0));
(Integer.parseInt(String.valueOf(vdata.get(0))) > 0)
这去了就xing了!是shen么原因?急
报的cuo误是:Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at appstu.view.JF_login.jBlogin_actionPerformed(JF_login.java:143)
at appstu.view.JF_login_jBlogin_actionAdapter.actionPerformed(JF_login.java:161)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.proceSSMouseEvent(Component.java:5517)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(......deng
Huan迎lai到Java学習者论坛,转载请注明地址:http://www.javaxxz.com. |
|