public class ProgressBar extends Control
You can create a horizontal endless ProgressBar, always going from left to right, by setting the given parameters:
Control.TranslucentShape
Modifier and Type | Field and Description |
---|---|
boolean |
drawBorder
If false, no border is drawn.
|
boolean |
drawText
Set to false to don't let the text be drawn.
|
boolean |
drawValue
Set to false to don't let the value be drawn.
|
int |
filledBarSize
The filled bar size (used when it's a endless bar)
|
boolean |
highlight
If true, the text is highlighted.
|
int |
highlightColor
The highlight color, or -1 to use one based on textColor.
|
int |
max
The maximum value of a progress bar.
|
int |
min
The minimum value of a progress bar.
|
java.lang.String |
prefix
The string prefix.
|
java.lang.String |
suffix
The string prefix.
|
int |
textColor
The text color
|
boolean |
vertical
If false, use horizontal mode (default)
|
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, DP, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, floating, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, next, nextTabControl, npParts, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, prev, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, SETX_NOT_SET, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
Constructor and Description |
---|
ProgressBar()
Creates a progress bar, with minimum and maximum set as 0 and 100, respectively.
|
ProgressBar(int min,
int max)
Creates a progress bar, String is set to
null , which is the default. |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears this control, setting the value to clearValueInt.
|
int |
getPreferredHeight()
Returns the preferred height.
|
int |
getPreferredWidth()
Gets the preferred width.
|
int |
getValue()
Returns the current value
|
void |
onBoundsChanged(boolean b)
Called after a setRect.
|
void |
onColorsChanged(boolean b)
Called after a setEnabled, setForeColor and setBackColor and when a control has
been added to a Container.
|
void |
onPaint(Graphics g)
Paint the Progress Bar.
|
void |
setEndless()
Call this method to make this ProgressBar a horizontal endless progressbar;
just keep calling
setValue(step)
to increase the value of the progressbar. |
void |
setNinePatch(Image img,
int side,
int corner)
Set the NinePatch of the control.
|
void |
setValue(int n)
Sets the current value.
|
void |
setValue(int value,
java.lang.String prefix,
java.lang.String suffix)
Sets the current value and the prefix and suffix.
|
_onEvent, addEnabledStateListener, addFocusListener, addFontChangeHandler, addGridListener, addHandler, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addSizeChangeHandler, addTimer, addTimer, addTimerListener, addValueChangeHandler, addWindowListener, bringToFront, changeHighlighted, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getDoEffect, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, handleGeographicalFocusChangeKeys, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isFloating, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onEvent, onFontChanged, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHandler, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, resetStyle, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setDoEffect, setEnabled, setFloating, setFocusLess, setFont, setForeColor, setNinePatch, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
public int min
public int max
public java.lang.String prefix
public java.lang.String suffix
public boolean drawText
public boolean drawValue
public int textColor
public boolean drawBorder
public boolean highlight
public int highlightColor
public boolean vertical
public int filledBarSize
public ProgressBar()
public ProgressBar(int min, int max)
null
, which is the default.
Uses the specified minimum for the initial value of the progress bar.min
- The minimum valuemax
- The maximum valuepublic void setEndless()
setValue(step)
to increase the value of the progressbar.public int getPreferredWidth()
getPreferredWidth
in class Control
public int getPreferredHeight()
getPreferredHeight
in class Control
public void setValue(int n)
If this is an endless ProgressBar, the given number is used as
an increment to the current value. Note that n must be greater than 0.
If you call this method and the bar isnt updated, you can try to call MainWindow.pumpEvents()
.
n
- The new valuegetValue()
public void setValue(int value, java.lang.String prefix, java.lang.String suffix)
value
- The new valuegetValue()
public int getValue()
public void onColorsChanged(boolean b)
Control
onColorsChanged
in class Control
public void onBoundsChanged(boolean b)
Control
onBoundsChanged
in class Control
b
- If the bounds were changed due to a screen change (rotation, collapse)public void setNinePatch(Image img, int side, int corner)
Control
setNinePatch
in class Control
img
- The image to make the NinePatch.
The image must be on a NinePatch format.side
- The size, in pixels, of the NinePatch's cornercorner
- The size, in pixels, of the NinePatch's side.public void onPaint(Graphics g)