![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e804. Displaying the Percentage Done on a JProgressBar ComponentThe 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);
e802. Creating a JProgressBar Component with an Unknown Maximum e803. Getting and Setting the Values of a JProgressBar Component e805. Listening for Value Changes in a JProgressBar Component © 2002 Addison-Wesley. |