java.mct.MlProgress

Component
    Canvas
        MlCanvas
            MlProgress

A progress bar which can be used to chart completion of a task. Along with a progress meter, this component may optionally display text with percentage completion and elapsed and estimated time to completion.

This component overrides its default font to Helvetica Bold 12 and foreground to dark blue. Any text drawn in the progress bar is drawn using the font and foreground/background values contained in the MlCanvas base class. The progress bar is drawn in the foreground color.

Resources

Name                 Type                 Default
bottomShadowColor    Color                #e1e1e1
completeValue        Integer              100
meterStyle           MeterStyle           METER_BAR
numBoxes             Integer              20
shadowThickness      Integer              1
showPercentage       Boolean              true
showTime             Boolean              false
topShadowColor       Color                #3c3c3c
value                Integer              0

bottomShadowColor
The bottom color of the component's shadow.

completeValue
Defines the maximum value of the value resource. When the value resource reaches this number, the progress bar will show 100% complete. This value is used to determine the percentage complete and to estimate time to completion.

meterStyle
The style of the meter to draw. Possible values:

     METER_BAR           standard bar meter
     METER_BOXES         shadowed boxes meter
Only the METER_BAR style can display the percentage complete indicator and optional estimated time to completion.

numBoxes
When meterStyle is METER_BOXES, this resource defines the number of boxes to display in the meter.

shadowThickness
The thickness of the component's shadow in pixels.

showPercentage
If set to true, text will be shown centered in the component displaying the current percentage complete. The percentage complete is calculated by dividing the value by the completeValue.

showTime
If set to true, the component will display the elapsed time in the left of the component and the estimated time remaining on the right. The estimated time remaining is calculated using the value, the completeValue and the start time. The start time is the last time the value was set to 0. No estimated time is shown when value is 0 or when it is equal to the completeValue. If set to false, only a percentage complete indicator will be shown.

topShadowColor
The top color of the component's shadow.

value
A value from 0 to the completeValue which defines how much progress has taken place. When this value is set to 0, the current time is stored as the start time for calculating estimated time to completion.

Public Methods

public void updateDisplay()
Will cause the progress bar to paint() to the display. If you set the value of the progress bar in the loop of a single thread and want the display to immediately update to reflect the new value, you should call this function.

public void setValue(int value)
Sets the value of the meter. Calling this function is equivalent to calling setValue("value", value);