ProgressBar
A JProgressBar reporting how far along a task is: it fills in proportion to where value stands between min and max. The user changes nothing here - the bar renders what the composition declares and reports nothing back.
Parameters
the current value
the SwingModifier applied to the underlying component
the value an empty bar stands at; 0 by default
the value a full bar stands at; 100 by default, so an undeclared range makes value a percentage
whether the bar animates constantly instead of filling to value; false by default. Declare true for work whose length is not known yet, and go back to false once it is
the orientation of the progress bar (an Orientation SwingConstants value); HORIZONTAL by default, which grows the filled part along the bar's width
whether the bar paints text over itself; false by default
the text painted over the bar; null by default, which leaves the bar to paint the completion percentage, so stringPainted on its own gives a percentage readout
See also
A JProgressBar reporting the progress a caller-owned BoundedRangeModel holds. The model owns the value and the range, so nothing is declared over it: the bar renders whatever the model holds, and a model the caller mutates repaints the bar without a recomposition. Supplying a new model instance installs it on recomposition.
This is what lets one range drive several widgets - a Slider the user moves and the bar reading it out, or two views of the same progress - since each of them renders the model as-is:
val range = remember { DefaultBoundedRangeModel(30, 0, 0, 100) }
Slider(model = range)
ProgressBar(model = range)Parameters
the range the bar renders; owned by the caller
the SwingModifier applied to the underlying component
whether the bar animates constantly instead of filling to the model's value; false by default. Declare true for work whose length is not known yet, and go back to false once it is
the orientation of the progress bar (an Orientation SwingConstants value); HORIZONTAL by default, which grows the filled part along the bar's width
whether the bar paints text over itself; false by default
the text painted over the bar; null by default, which leaves the bar to paint the completion percentage, so stringPainted on its own gives a percentage readout