Strange delay in modifying JPanel
Hi
Once the "Login" button is pressed, I want my JPanel to show the string "Connecting..." so I added a simple card panel to show either "Welcome" or "connecting...".
When the button is pressed, the code flows as expected, except that the card does not change until the Oracle database connection (from the checkUser method) returns. So basically, it only says "connecting..." after trying to connect. It's as if the JPanel/JFrame is not allowing any updates until the checkUser returns. checkUser just as a try block attempting to connect to a db.
Any ideas?
publicvoid actionPerformed(ActionEvent ae){
// char array to store the password
char[] charInputPassword;
// Set the Panel to show "Connecting..."
((CardLayout)cardPanel.getLayout()).show(cardPanel, CONNPANE);
// The text below appears in CMD window when logingButton button is pressed
// but the card panel doesn't not change until the checkUser
// procedure has completed. ?
TextIO.putln("Panel should now show CONNPANE");
if(ae.getSource() == loginButton){
inputUsername = usernameField.getText();
charInputPassword = passwordField.getPassword();
inputPassword =new String(charInputPassword);
TextIO.putln("OK Pressed - Username is " + inputUsername);
try{
checkUser();
}catch(Exception e){
TextIO.putln("CheckUser error: " + e.getMessage());
}
}
}

