I am trying to update our SQL database from a JFrame panel in Netbeans. Currently, I am trying to use a button in from the "registernewStudent" panel, where the user can assing 4 text fields, where the first (Student ID) and the last (room) should be an integer and the middle 2 are strings. However, I am getting an errormessage saying "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException"
Below are the source code for the button.
This is our first real project, so we'd appreciate any help we could get.
private void btnNyREActionPerformed(java.awt.event.ActionEvent evt) {
try {
String talStrang1 = txtElevID.getText();
int tal1 = Integer.parseInt(talStrang1);
String Strang2 = txtElevFN.getText();
String Strang3 = txtElevEN.getText();
String talStrang4 = txtElevSS.getText();
int tal2 = Integer.parseInt(talStrang4);
database.insert("insert into Elev values( tal1, Strang2, Strang3,tal2)");
} catch (InfException ex) {
Logger.getLogger(NyRegElev.class.getName()).log(Level.SEVERE, null, ex);
}
}