📄 e804. displaying the percentage done on a jprogressbar component.txt
字号:
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 Creating a JProgressBar Component with an Unknown Maximum).
// 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -