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

  • Home
  • SEARCH
  • 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 8262309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:43:07+00:00 2026-06-08T03:43:07+00:00

I want a indeterminate progress bar to pop up as soon as the user

  • 0

I want a indeterminate progress bar to pop up as soon as the user presses the “run” button and then close when the work to be done by the application is finished. I used NetBeans to develop the GUI. How should I go about it? The gui class extends JFrame. Here is the action listener for the run button:

public class GUI extends JFrame{
    // other methods and constructos....
private JProgressBar pb = new JProgressBar();
private void runButtonActionPerformed(java.awt.event.ActionEvent evt) {                                          


   pb.setIndeterminate(true);

   //other functions start...
   runButton.setEnabled(false);
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   //....blah blah
}
}

How do I add the progressbar to my JFrame, and then remove it when my work is done? I do NOT want to use Swing Worker.

  • 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-06-08T03:43:09+00:00Added an answer on June 8, 2026 at 3:43 am

    You do not want to use the SwingWorker but you will have to (or a similar mechanism). You cannot show a JProgressBar while you keep the Event Dispatch Thread (EDT) occupied with your calculations.

    You will have to move your calculations to a separate Thread to free the EDT. Then the EDT will be able to show a JProgressBar during the calculations, and remove it when they are finished.

    More information on this can be found in the ‘Concurrency in Swing’ tutorial. An example of a SwingWorker and a JProgressBar can be found here.

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

Sidebar

Related Questions

I want to stop the indeterminate mode of the progress bar, once my doInBackground
In my application I want to display the progress bar 1000msec. I am using
I want to show the user detailed progress information when performing potentially lengthy database
I want to Make Horizontal Progress bar Thin i want to change Internal Progress
want to open pdf file when a user clicks on hyperlink shown in gridview
Want to run javascript function from parent window in child window Example I have
want to have a Hyperlink-Button in a gridView in which I can display a
Want the function to sort the table by HP but if duplicate HPs then
I want to use the indeterminate property of a checkbox. Changing the value in
In C#, if you want a method to have an indeterminate number of parameters,

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.