I will like to display a series of messages for few seconds and disappears during connection to DB. How do I do that in Java?
The first message should say "Connecting to database", the second message should say "creating a database" and the last message should say " database creation successful".
Here is the code of the class. I simply want to replace println statement with a pop up that closes it after few seconds.
  public class ExecuteSQL {
   static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";  
   static final String DB_URL = "jdbc:mysql://localhost/?allowMultiQueries=true";
   //  Database credentials
   static final String USER = "root";
   static final String PASS = "";
public static void connectExe() {
        Connection conn = null;
           Statement stmt = null;
           try{
              Class.forName("com.mysql.jdbc.Driver");
              System.out.println("Connecting to database...");
              conn = DriverManager.getConnection(DB_URL, USER, PASS);
              System.out.println("Creating database...");
              stmt = conn.createStatement();
              String sql = Domain.getCurrentDatabaseSQL();
              stmt.executeUpdate(sql);
              System.out.println("Database created successfully...");
           }catch(SQLException se){
              se.printStackTrace();
           }catch(Exception e){
              e.printStackTrace();
           }finally{
              try{
                 if(stmt!=null)
                    stmt.close();
              }catch(SQLException se2){
              }
              try{
                 if(conn!=null)
                    conn.close();
              }catch(SQLException se){
                 se.printStackTrace();
              }
           }//end try
    }
}  
I'm using Swing.
 
     
    