加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 在不了解进度的情况下更新JProgressBar

发布时间:2020-12-15 04:55:26 所属栏目:Java 来源:网络整理
导读:我想使用JProgressBar,但我没有任何关于完成任务需要多长时间的进度测量.我的想法是有一个显示关闭过程状态的进度条,但我不知道它需要多长时间,而且我无法编辑执行关闭过程的类. 有没有办法使用JProgressBar而没有任何进展指示? 解决方法 调用setIndetermin
我想使用JProgressBar,但我没有任何关于完成任务需要多长时间的进度测量.我的想法是有一个显示关闭过程状态的进度条,但我不知道它需要多长时间,而且我无法编辑执行关闭过程的类.

有没有办法使用JProgressBar而没有任何进展指示?

解决方法

调用setIndeterminate(true).

从javadocs:

To indicate that a task of unknown length is executing,you can put a progress bar into indeterminate mode. While the bar is in indeterminate mode,it animates constantly to show that work is occurring. As soon as you can determine the task’s length and amount of progress,you should update the progress bar’s value and switch it back to determinate mode.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读