Displaying the Percentage Done on a JProgressBar Component
import javax.swing.JProgressBar;
public class Main { public static void main(String[] argv) throws Exception { int minimum = 0; int maximum = 100;
JProgressBar progress = new JProgressBar(minimum, maximum);
// Overlay a string showing the percentage done
progress.setStringPainted(true);