I've got a problem with setVisible for ProgressBar, I wanna show a progressbar after clicking a Login button in my application, which will execute also a login to mysql database. The problem is that, the showing a progress bar is made as last thing during handling a button click.
public void handleLoginButton() {
Connection connection = null;
int wasError=0;
loadingBar.setVisible(true);
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
return;
}
try {
connection = DriverManager
.getConnection("jdbc:mysql://address","USER","PASSWORD");
} catch (SQLException e) {
wasError=1;
System.out.println("Connection Failed! Check output console");
//e.printStackTrace();
return;
}
if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
}
}
How to make that the setVisible should be executed first?