Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7036897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:28:43+00:00 2026-05-28T01:28:43+00:00

I have a JFrame, where a database connection is established immediately. This connection takes

  • 0

I have a JFrame, where a database connection is established immediately. This connection takes up to 2 seconds, meanwhile I want to show a message (or another JFrame). After the connection is established, the message should disappear.

I have a bad example, does anybody have a better idea?

public class Main extends JFrame {

    View v = new View();
    static JFrame loader = new JFrame();
    static JLabel loading = new JLabel("Loading");

    public Main() {
        this.add(v);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
        this.setBounds(100, 50, 800, 500);

        loader.setBounds(500, 300, 100, 100);
        loader.setVisible(true);
        loader.add(loading);
    }

    public static void main(String[] args) {
        Main m = new Main();
        if (DB.INSTANCE.connect()) {
            m.setVisible(true);
            loader.setVisible(false);
        } else {
            loading.setText("DB ERROR");
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:28:44+00:00Added an answer on May 28, 2026 at 1:28 am

    If the task is to create a splash dialog (a frame shown during the application startup while some initialisation work is being done), here is a tutorial on how to do it with Swing’s SplashScreen: http://docs.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JFrame with a JPanel on it. I want to add another
I have a JFrame and In which I want to show a JInternal Frame
I have a JFrame. This JFrame contains a JButton. I click the JButton and
I have a JFrame and I open a JDialog from it and another JDialog
This one's a tough one - I have a JFrame that generates JTextFields. When
I have a JFrame that accepts top-level drops of files. However after a drop
I have this logical problem regarding on how to pass value from one JFrame
I have a JFrame that contains a JTextPane. The purpose of this JTextPane is
I have a JFrame that is the main class of the program. I want
I have a JFrame panel. It opens several times. However, I want the previous

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.