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

相关文章:

  • 2021-09-21
  • 2021-12-02
  • 2021-11-29
  • 2022-03-14
  • 2021-10-20
  • 2021-09-10
  • 2022-12-23
  • 2021-12-22
猜你喜欢
  • 2022-12-23
  • 2021-07-29
  • 2022-01-02
  • 2022-12-23
  • 2021-10-12
  • 2022-03-02
  • 2022-01-24
相关资源
相似解决方案