CircularProgressBarUI Demo

What Is It

The CircularProgressBarUI is a javax.swing.plaf.basic.BasicProgressBarUI that displays the progress of a JProgressBar as an arc than starts at the top of a circle and progresses clockwise.

How To Use It

Simply call:

progressBar.setUI(new CircularProgressBarUI());

And then you can add any number of additional properties, such as:

progressBar.putClientProperty(CircularProgressBarUI.PROPERTY_STROKE_WIDTH, 4);
progressBar.putClientProperty(CircularProgressBarUI.PROPERTY_PULSE_COMPLETION_ACTIVE, true);
progressBar.putClientProperty(CircularProgressBarUI.PROPERTY_SPARK_ACTIVE, true);
progressBar.putClientProperty(CircularProgressBarUI.PROPERTY_ACCELERATE, true);
progressBar.putClientProperty(CircularProgressBarUI.PROPERTY_TRANSITION, true);

How It Works

This is relatively straight-forward ProgressBarUI. It includes support for JProgressBar methods like getPercentComplete(), isIndeterminate(), isStringPainted(), getString(), getForeground(), getBackground() and getFont(). Also it includes these additional features:

Discussion

There are several great articles further discussing the UX implications of progress feedback. For this project I consulted this one, this onethis one and this one. (And I don't know what to make of this one, but it's very interesting!)

The "indeterminate" property of JProgressBars is a little peculiar. In hindsight: it might have been nice if indeterminate progress bars had been an entirely separate JComponent, because a core part of their data model (the BoundedRangeModel) doesn't make sense when they are indeterminate. (The JThrobber mostly addresses this separation.) But to be fair: JProgressBars have been around since J2SE 1.2, and small (mostly circular) throbbers weren't a phenomenon at that time.

Also remember on Mac you can set the client property "JProgressBar.style" to "circular" on a JProgressBar to get the default Mac throbber.