Swing中的Java任务进度条 [英] Java Task Progress Bars in Swing
问题描述
我需要一个非常简单的(骨架)教程,用于在Java中开发GUI的进度条。进度条可以是不确定的,理想情况下有一个可更新的文本标签。
I need a very simple (skeletal) tutorial on progress bars for developing a GUI in Java. The progress bar can be "indeterminate" and ideally have an updateable text label.
这是一些骨架代码,我希望有人可以扩展到足以让某些东西工作。
Here is some skeletal code that I hope someone can expand upon just enough to get something working.
class MyFunView extends FrameView {
// class vars and other stuff...
@Action
public void excitingButtonPressed() {
/* I have n files to download */
// Download file 1, set progress bar status to "downloading file 1"
// ...
// Download file n, set progress bar status to "downloading file 2"
}
}
基本上,我如何以及如何包装下载代码? (我知道需要某种子类的任务吗?)
Basically, how and what do I wrap my download code in? (I understand there is some kind of subclass of Task required?)
非常感谢提前。
编辑:
我们都只有很多宝贵的时间活着,没有办法像我希望的那么少的代码或时间,所以我不会使用进度条。
We all only have so much precious time to be alive, and no approach can be done in as little code or time as I would have hoped, so I will not be using a progress bar.
推荐答案
我需要一个关于进度条的非常简单的(骨架)教程用Java开发GUI。
I need a very simple (skeletal) tutorial on progress bars for developing a GUI in Java.