I am working on a Swing based small project. In this project I want to open another window when user log-in successfully but when I click log-in
button an exception occurred, like "Illegal attempt to exit early"
, while my database connection is well because when I show message dialog then it shows successful log-in. Here is my code.
package org.Core.Art;
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;
public final class CoreTopComponent extends TopComponent {
private String password;
private String pwd;
private Component jPasswordField1;
private Component jButton1;
//private Object text_password;
public CoreTopComponent() {
initComponents();
}
private void ClickActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Object password = text_password.getText();
String query = "Select * from assistant where pass = '"+password+"'";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/auto_lube","root", "mehar");
Statement stmt = conn.createStatement();
stmt.execute(query);
ResultSet rs = stmt.getResultSet();
boolean recordfound = rs.next();
if (recordfound) {
Login regFace = new Login();
regFace.setVisible(true);
dispose();
//JOptionPane.showMessageDialog(null,"You are login successfully");
} else {
JOptionPane.showMessageDialog(null,"Try again");
// new Login_fram().setVisible(true);
}
conn.close();
} catch(java.lang.ClassNotFoundException ex) {
JOptionPane.showMessageDialog(null,"Exception Occured"+ex.getMessage());
} catch(Exception ex) {
JOptionPane.showMessageDialog(null,"Exception Occured"+ex.getMessage());
}
}
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);
}
});
}
}
And my other class is Login.java
and I want when user click log_in
button if record found then open a new window or Login.java
.