I am working in swing based project.In which i want to open a new window when user log-in successfully but when i click log-in button exception occurred"org.net-bean.ExitSecurityException:Illegal attempt to exit early" i also check my record using print out everything is working well but i have no idea how to fix this problem.Here is my code.
import java.awt.Component;
import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.windows.TopComponent;
import org.openide.util.NbBundle.Messages;
import java.sql.*;
import javax.swing.*;
import org.openide.util.Exceptions;
class CoreTopComponent extends TopComponent {
Connection conn = null;
ResultSet rs = null;
PreparedStatement pst = null;
private String password;
private String pwd;
private Component jPasswordField1;
private Component jButton1;
//private Object text_password;
public CoreTopComponent() {
initComponents();
conn = mysqlconnect.ConnecrDb();
}
private void ClickActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Object password = text_password.getText();
String sql = "Select * from assistant where pass =?";
try {
pst = conn.prepareStatement(sql);
pst.setString(1, text_password.getText());
rs = pst.executeQuery();
if (rs.next()) {
JOptionPane.showMessageDialog(null, "You are login successfully");
//setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
org.openide.LifecycleManager.getDefault();
Login s = new Login();
s.setVisible(true);
} else {
JOptionPane.showMessageDialog(null, "You are not login successfully");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
} finally {
try {
rs.close();
pst.close();
} catch (Exception e) {
}
}
}
private void text_passwordActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Object password = text_password;
}
public static void main(String args[]) {
CoreTopComponent core = new CoreTopComponent();
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new CoreTopComponent().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JToggleButton Click;
private javax.swing.JEditorPane jEditorPane1;
private javax.swing.JLabel jLabel1;
private javax.swing.JOptionPane jOptionPane1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JPasswordField text_password;
}
And my mysql connection code is here
package org.Core.Art;
import java.sql.*;
import javax.swing.*;
public class mysqlconnect {
Connection conn = null;
public static Connection ConnecrDb() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/auto_lube", "root", "mehar");
JOptionPane.showMessageDialog(null, "Connection established");
return conn;
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
return null;
}
}
I visit many site but i can not solve it.Somebody share any link or guide me thanks.