zl程序教程

您现在的位置是:首页 >  其它

当前栏目

e804. 显示JProgressBar的完成百分率

显示 完成
2023-09-14 09:11:59 时间

The progress bar offers the ability to display the actual value of the bar as a percentage. This example demonstrates how to enable this display.

Note: The percentage display should not be enabled when the maximum is not known (e802 创建一个位置大小的JProgressBar组件).

    // Create a horizontal progress bar
    int minimum = 0;
    int maximum = 100;
    JProgressBar progress = new JProgressBar(minimum, maximum);
    
    // Overlay a string showing the percentage done
    progress.setStringPainted(true);

 

Related Examples