ProgressMultiTest illustrates a simple use of multiple threads, in this case, to test multiple instances/configurations of the Progress class.
A Progress object displays a graphical, bar-like progress gauge (meter). Progress supports left-to-right, right-to-left, bottom-to-top, and top-to-bottom orientations, as well as text display of the current percent-completion value. The latter can be disabled; see the fourth Progress instance.
To configure the orientation (other than the default
Orientation.LEFT_RIGHT), first create an
Orientation object initialized to the required
orientation and then pass this object to the Progress
constructor:
Orientation bt = new Orientation(Orientation.BOTTOM_TOP);
...
Progress progress = new Progress(40, 150, 5,
bt, /* orientation */
new DisplayPercent(DisplayPercent.No),
Color.darkGray, Color.cyan, Color.red);
To disable the displaying of the textual percent-completion value,
first create a DisplayPercent object initialized to
DisplayPercent.NO and then pass this object
to the Progress constructor:
DisplayPercent ndp = new DisplayPercent(DisplayPercent.No);
...
Progress progress = new Progress(40, 150, 5,
new Orientation(Orientation.TOP_BOTTOM),
ndp, /* no display of percentage */
Color.darkGray, Color.cyan, Color.red);
Other configurable characteristics include width, height, margin width, background color, foreground color, and text color.
The supporting class ConfigureProgress is useful
for overriding arbitrary configuration characteristics without having
to search the API for a constructor with an appropriate signature. Its
constructor initializes each configuration-related variable to
the Progress object's default value. Subsequently, you
can override any or all of the values for its public Progress configuration variables:
ConfigureProgress cp = new ConfigureProgress();
cp.width = 40;
cp.height = 150;
cp.display_percent = new DisplayPercent(DisplayPercent.NO);
progress = new Progress(cp);