Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make an endless progressbar in Swing?

Like this question, I'd like to do the same with Swing in Java. I looked for the JProgressBar on NetBeans, but I couldn't find an option like that. There is another component that would perform this task or there is an option in the JProgressBar?

The reason for using this component in this way is the same of that question's OP.

like image 916
Zignd Avatar asked Dec 20 '22 04:12

Zignd


2 Answers

According to the Oracle Java Tutorial you can simply use the indeterminate mode for progess bars in swing:

yourProgressBar.setIndeterminate(true);

Sometimes you can't immediately determine the length of a long-running task, or the task might stay stuck at the same state of completion for a long time. You can show work without measurable progress by putting the progress bar in indeterminate mode. A progress bar in indeterminate mode displays animation to indicate that work is occurring.

like image 99
bpoiss Avatar answered Dec 27 '22 12:12

bpoiss


progressBar.setIndeterminate(true);
like image 36
ejoncas Avatar answered Dec 27 '22 11:12

ejoncas