Java 对话框循环栏

Java dialog loop bar

我有一个 java 程序可以将一个小文本文件上传到 ftp 服务器。有时上传可能需要长达 30 秒,因为服务器很慢,这是程序闲置的时间。我想知道在用户等待上传完成时是否会显示一种 "loop progress bar"(有点像 windows 正在加载时的进度条)。
一个正常的进度条是不可能的。我想要的是 "loop progress bar" 如果你能理解我的意思的话。谢谢
注意:我要的是像这样的图片

这是一个被问了很多的问题。我发现这样做是为了寻找教程 online.there 不是您可以添加的简单的一行代码,但我过去曾使用过该教程, http://www.avajava.com/tutorials/lessons/how-do-i-display-file-upload-progress-using-the-dojo-progressbar.html 我不想尝试改写这里已经说过的话,作者做得很好。如果您在此之后有任何问题,我可以回答更具体的问题。

试试这个:

progressBar.setIndeterminate(true);

根据http://docs.oracle.com/javase/7/docs/api/javax/swing/JProgressBar.html

Sets the indeterminate property of the progress bar, which determines whether the progress bar is in determinate or indeterminate mode. An indeterminate progress bar continuously displays animation indicating that an operation of unknown length is occurring. By default, this property is false. Some look and feels might not support indeterminate progress bars; they will ignore this property.