Am currently doing a project with a java GUI interrogating a database. My first GUI is a [U]Login[/U] display which when the user successfully logs in will move onto a [U]Menu[/U] display. My problem is that I cannot get from the [U]Login[/U] display to the [U]Menu[/U] display. These GUIs have been set up using JBuilder3.
I can see that I am successfully logging on in that the login display disappears but the next page wont appear.
The frames were set up using a JDesktopPane which supports the various JInernalFrames.
The desktop pane however was created by default with a menu bar which when you open the file option has new frame as an option. It is in fact necessary to use this facility to get my login display on the screen at the star.
Clarifying this issue would be pretty critical in moving on with this project.
Below is the code for the OK button on the [U]Login[/U] display with the ref to [U]mainMenu[/U] being the display I'm trying to get to.
Thanks in advance
void buttonOK_actionPerformed(ActionEvent e) {
Statement statement;
ResultSet resultset;
String accesslevel = (String) jComboBoxLevel.getSelectedItem();
String uname, pword, unamedb, pworddb;
if (accesslevel == "Librarian") {
try {
uname = jTextFieldUsername.getText();
pword = jTextFieldPassword.getText();
statement = connection.createStatement();
resultset = statement.executeQuery("Select * From Librarian_Logon_Table");
while (resultset.next()) {
unamedb = resultset.getString(2);
pworddb = resultset.getString(3);
if (unamedb.equals(uname) && pworddb.equals(pword)) {
try {
this.setVisible(false);
mainMenu m = new mainMenu();
m.setVisible(true);
}
catch (Exception e1) {
JOptionPane.showMessageDialog(null, "Problem 1", "Problem 1", JOptionPane.INFORMATION_MESSAGE);
}
}
}
jTextFieldUsername.setText("");
jTextFieldPassword.setText("");
}
catch (Exception e1) {
JOptionPane.showMessageDialog(null, "Problem 2", "Problem 2", JOptionPane.INFORMATION_MESSAGE);
}
}
else {
JOptionPane.showMessageDialog(null, "Choose the correct choice from combo box", null, JOptionPane.INFORMATION_MESSAGE);
jTextFieldUsername.setText("");
jTextFieldPassword.setText("");
}
}
}