e802. 创建一个位置大小的JProgressBar组件

A progress bar with an unknown maximum typically displays an animation until the task is complete.

Note: The percentage display should not be enabled when the maximum is not known (e804 显示JProgressBar的完成百分率).

    // Create a horizontal progress bar
    int min = 0;
    int max = 100;
    JProgressBar progress = new JProgressBar(min, max);
    
    // Play animation
    progress.setIndeterminate(true);

When information on the task's progress is available, the progress bar can be made determinate:

    int value = 33;
    progress.setValue(value);
    progress.setIndeterminate(false);

 

Related Examples
posted @ 2018-09-06 08:58  borter  阅读(173)  评论(0编辑  收藏  举报