|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j4me.ui.components.Component
org.j4me.ui.components.ProgressBar
public class ProgressBar
Displays a progress bar that indicates the state of a background process.
Progress bars come in two flavors. There is the standard progress
bar which appears as a rectangle that fills from left-to-right as
progress toward some known point occurs. There is also a spinner
which is animated to show constant progress and is useful when it
is unknown how long the operation will last. These are differentiated
by setMaxSize
; when 0 it is a spinner and when positive it
is a progress bar.
Field Summary |
---|
Fields inherited from class org.j4me.ui.components.Component |
---|
container, HIGHLIGHTED_BORDER_WIDTH |
Constructor Summary | |
---|---|
ProgressBar()
Creates a progress bar component. |
Method Summary | |
---|---|
java.lang.String |
getLabel()
|
int |
getMaxValue()
Returns the maximum amount of progress. |
protected int[] |
getPreferredComponentSize(Theme theme,
int viewportWidth,
int viewportHeight)
Returns the dimensions of the progress bar. |
double |
getRelativeHeight()
Returns the height of the progress bar relative to the height of the default font specified in the theme. |
double |
getRelativeWidth()
Gets how far across the screen the progress bar extends. |
int |
getValue()
|
protected void |
hideNotify()
An event raised whenever the component is removed from the screen. |
protected void |
paintBar(javax.microedition.lcdui.Graphics g,
Theme theme,
int x,
int y,
int width,
int height,
boolean selected)
Paints a progress bar that shows an operation with a known duration. |
protected void |
paintComponent(javax.microedition.lcdui.Graphics g,
Theme theme,
int width,
int height,
boolean selected)
Paints the progress bar. |
protected void |
paintSpinner(javax.microedition.lcdui.Graphics g,
Theme theme,
int x,
int y,
int width,
int height,
boolean selected)
Paints a spinner component used to show progress during an operation of an unknown duration. |
void |
setLabel(java.lang.String label)
|
void |
setMaxValue(int max)
|
void |
setRelativeHeight(double percentageOfFontHeight)
Sets the height of the progress bar relative to the default font specified in the theme. |
void |
setRelativeWidth(double percentageOfScreen)
Sets how far across the screen the progress bar extends. |
void |
setValue(int value)
Sets the maximum amount of progress. |
protected void |
showNotify()
An event raised whenever the component is made visible on the screen. |
Methods inherited from class org.j4me.ui.components.Component |
---|
acceptsInput, getHeight, getHorizontalAlignment, getPreferredSize, getScreen, getWidth, getX, getY, invalidate, isShown, keyPressed, keyReleased, keyRepeated, paint, paintRect, pointerDragged, pointerPressed, pointerReleased, repaint, setHorizontalAlignment, visible |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProgressBar()
Method Detail |
---|
public java.lang.String getLabel()
null
there is no text.public void setLabel(java.lang.String label)
label
- is the text that appears above the progress bar.
If null
there will be no text.public int getValue()
public void setValue(int value)
value
- is the amount of completed progess.public int getMaxValue()
public void setMaxValue(int max)
max
- is the maximum amount of progress.public void setRelativeWidth(double percentageOfScreen)
percentageOfScreen
- is the length of the progress bar relative
to the width of the screen. It must be between 0.00 and 1.00.public double getRelativeWidth()
public void setRelativeHeight(double percentageOfFontHeight)
percentageOfFontHeight
- is how tall, relative to the default font,
the progress bar is. For example 1.2 is 120% the size.public double getRelativeHeight()
protected void paintComponent(javax.microedition.lcdui.Graphics g, Theme theme, int width, int height, boolean selected)
paintComponent
in class Component
g
- is the Graphics
object to be used for rendering the item.theme
- is the application's theme. Use it to get fonts and colors.width
- is the width, in pixels, to paint the component.height
- is the height, in pixels, to paint the component.selected
- is true
when this components is currently selected
and false
when it is not.Component.paintComponent(Graphics, Theme, int, int, boolean)
protected void paintBar(javax.microedition.lcdui.Graphics g, Theme theme, int x, int y, int width, int height, boolean selected)
getCurrent / getMax
percent of the progress bar.
g
- is the Graphics
object to be used for rendering the item.theme
- is the application's theme. Use it to get fonts and colors.x
- is the left side of the component.y
- is the top side of the component.width
- is the width, in pixels, to paint the component.height
- is the height, in pixels, to paint the component.selected
- is true
when this components is currently selected
and false
when it is not.protected void paintSpinner(javax.microedition.lcdui.Graphics g, Theme theme, int x, int y, int width, int height, boolean selected)
g
- is the Graphics
object to be used for rendering the item.theme
- is the application's theme. Use it to get fonts and colors.x
- is the left side of the component.y
- is the top side of the component.width
- is the width, in pixels, to paint the component.height
- is the height, in pixels, to paint the component.selected
- is true
when this components is currently selected
and false
when it is not.protected int[] getPreferredComponentSize(Theme theme, int viewportWidth, int viewportHeight)
getPreferredComponentSize
in class Component
theme
- is the application's Theme
.viewportWidth
- is the width of the viewable area, in pixels,
the component can use.viewportHeight
- is the height of the viewable area, in pixels,
the component can use.
Component.getPreferredComponentSize(org.j4me.ui.Theme, int, int)
protected void showNotify()
paintComponent
method.
showNotify
in class Component
Component.showNotify()
protected void hideNotify()
hideNotify
in class Component
Component.hideNotify()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |