I have a VB6 project that connects to a remote MySql database. I connect Asynchronously.

I like this method because as it's connecting, I have a "Loading" animation display inside a textbox.

If the connection is successful, then I execute a command.

If the connection fails, I execute another command.

I just downloaded Netbeans for Java. I am wondering how I can accomplish what I just described in Java.

Does anyone have any sources that I can read up on to do what I need?

I have been searching, but couldn't find what I'm looking for yet. Thank you.