I want to add a progressBar (just to show that something is happening) when the database rows are fed into a table.
First I tried to create a frame, where I added progressBar. I called frame.visible in the while loop which populates the table with database datas. But the frame doesn't show till all the rows are in the table. So it shows too late.
Then I tried to add the progressBar to a dialog, but that was even worse: the dialog shows, but it didn't do anything in background- I have to close that dialog, and then the table is loaded with data...

Recommended Answers

All 4 Replies

you will have to launch the JFrame in a different thread if you want the progress bar to fill and the table to fill at the "same time", otherwise your program is gonna do one then the other.

I haven't played with Threads in a bit but i can advise you right now that implementing Runable is better than extending Thread, good luck and keep us updated :)

that looks great, I'm gonna try it...

Thanks!

You're welcome!
And do run the examples once; the code is not complicated at all, and best of luck with whatever you're making/trying to do! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.