我想帮助我:
我有一个系统用户注册JInternalFrame
,并且有另一个系统用户级访问权限注册JInternalFrame
。
当某人填写数据以注册用户并按REGISTER
按钮时,请拨打我的系统用户级访问权限JInternalFrame
。
我试图按照他们在其他帖子中所说的做但却没有用。
public void cadastrarUsuarios() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
String sql = "Insert into login (nome_login, usuario_login, senha_login) values (?,?,?)";
try {
pst = con.prepareStatement(sql);
pst.setString(1, txtNome.getText()); //Passando valor de "nome de usuário" para o campo da tabela "txtNome"
pst.setString(2, txtUsuario.getText()); //Passando valor de "telefone de usuário" para o campo da tabela "txtTelefone"
pst.setString(3, txtSenha.getText()); //Passando valor de "Endereço de usuário" para o campo da tabela "txtTelefone"
pst.execute();
JOptionPane.showMessageDialog(null, "Usuário cadastrado com sucesso!", "Cadastrado com sucesso", JOptionPane.INFORMATION_MESSAGE);
listarUsuarios(); //Atualizando dados na tabela instantaneamente no momento do cadastro do usuário
JDesktopPane desktopPane = this.getDesktopPane();
desktopPane.add(frmCadNiveisAcesso);
frmCadNiveisAcesso.setVisible(true);
}
catch (SQLException error) {
JOptionPane.showMessageDialog(null, error);
}
}
这是错误:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at java.util.Hashtable.get(Hashtable.java:363) at java.util.Hashtable.get(Hashtable.java:363) at javax.swing.JLayeredPane.getLayer(JLayeredPane.java:396) at javax.swing.JLayeredPane.addImpl(JLayeredPane.java:228) at javax.swing.JDesktopPane.addImpl(JDesktopPane.java:483) at java.awt.Container.add(Container.java:415) at VISUAL.FRMCadUsuarios.cadastrarUsuarios(FRMCadUsuarios.java:85) at VISUAL.FRMCadUsuarios.BTCadastrarActionPerformed(FRMCadUsuarios.java:380) at VISUAL.FRMCadUsuarios.access$200(FRMCadUsuarios.java:16) at VISUAL.FRMCadUsuarios$3.actionPerformed(FRMCadUsuarios.java:261) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6527) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at java.awt.Component.processEvent(Component.java:6292) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4883) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Component.dispatchEvent(Component.java:4705) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462) at java.awt.Container.dispatchEventImpl(Container.java:2278) at java.awt.Window.dispatchEventImpl(Window.java:2739) at java.awt.Component.dispatchEvent(Component.java:4705) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:719) at java.awt.EventQueue$4.run(EventQueue.java:717) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:716) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) 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)