|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfds.micro.ui.Component
fds.micro.ui.Slider
This class implements a slider. It can be two forms: normal mode (displayed as a ruler),
or field mode (displayed as a field with buttons to increment and decrement value).
An object of this class is dedicated to be used within an object of fds.micro.ui.AbstractPanel sub-class (J2ME).
Warning: Use this class only if you want to have control on rendering. If possible, always prefer javax.microedition.lcdui.Item sub-classes.
You can read below a typical use within a class that inherit fds.micro.ui.RowPanel:
Construction
... // Add a slider in field mode with values from 10 to 20. this.slider = new Slider(-1, 10, 20); this.slider.setFieldBackground(255, 255, 128); this.append(slider); ...Usage
... // Here we get the slider value int value = this.slider.getValue(); ...
Field Summary |
Fields inherited from class fds.micro.ui.Component |
INTERN_BOTTOM_VALIGN, INTERN_CENTER_HALIGN, INTERN_CENTER_VALIGN, INTERN_LEFT_HALIGN, INTERN_RIGHT_HALIGN, INTERN_TOP_VALIGN |
Constructor Summary | |
Slider()
Build a normal slider with a ruler of 50 pixels wide and range [0..100]. |
|
Slider(int rulerWidth)
Build a normal slider with specified ruler (or field mode) and range [0..100]. |
|
Slider(int minValue,
int maxValue)
Build a normal slider with a ruler of 50 pixels wide and given range. |
|
Slider(int rulerWidth,
int minValue,
int maxValue)
Build a normal slider with specified ruler (or field mode) and given range. |
Method Summary | |
void |
addValueChangeListener(ValueChangeListener listener)
Add a listener object that will receive events produced by this component when the value is changed. |
int |
getCursorPosition()
Get the position of the cursor in field. |
javax.microedition.lcdui.Font |
getFont()
Get the font used to display the value. |
int |
getMaxValue()
Get the maximum possible value. |
int |
getMinValue()
Get the minimum possible value. |
int |
getRulerWidth()
Get the ruler width, or -1 if field mode is used. |
int |
getValue()
Get the value. |
boolean |
isBoxOpaque()
Get the entry zone opacity flag. |
boolean |
isValueShown()
Get the value shown flag. |
void |
keyPressed(int keyCode,
int gameAction)
Called to notify the component that a key is pressed. |
void |
pointerPressed(int xpos,
int ypos)
Called to notify the component that pointer device was pressed. |
void |
removeValueChangListener(ValueChangeListener listener)
Remove a listener. |
void |
setBackground(int red,
int green,
int blue)
Set the component background color (under the component itself). |
void |
setBorderColor(int red,
int green,
int blue)
Set the color for field border. |
void |
setBoxOpaque(boolean boxOpaque)
Set a new value for entry zone opacity flag. |
void |
setCursorColor(int red,
int green,
int blue)
Set the color for field cursor. |
void |
setCursorPosition(int cursorPosition)
Change the position of the cursor in field. |
void |
setDisabled(boolean disabled)
Disable/enable the component. |
void |
setFieldBackground(int red,
int green,
int blue)
Set the color for field background. |
void |
setFieldBackgroundOff(int red,
int green,
int blue)
Set the color for field background if component is disabled. |
void |
setFocusColor(int red,
int green,
int blue)
Set the color for focus frame. |
void |
setFont(javax.microedition.lcdui.Font font)
Change the font used to display the value. |
void |
setLocation(int x,
int y)
Change the location of this component. |
void |
setMaximumSize(int width,
int height)
Set the maximum size for this component. |
void |
setOpaque(boolean opaque)
Set a new value for opaque flag. |
void |
setTextColor(int red,
int green,
int blue)
Set the field value color. |
void |
setTextColorOff(int red,
int green,
int blue)
Set the field value color if component is disabled. |
void |
setValue(int value)
Set a new value. |
void |
setValueShown(boolean valueShown)
Set a new value for value shown flag. |
Methods inherited from class fds.micro.ui.Component |
addFocusListener, addItemListener, equals, getHAlign, getHeight, getParent, getVAlign, getWidth, getX, getY, isDisabled, isHaveFocus, isHidden, isManageFocus, isOpaque, removeFocusListener, removeItemListener, setHAlign, setHidden, setManageFocus, setVAlign |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Slider()
public Slider(int rulerWidth)
rulerWidth
- The width of drawn ruler, or -1 if you want to use the field mode.public Slider(int minValue, int maxValue)
minValue
- The minimum possible value.maxValue
- The maximum possible value.public Slider(int rulerWidth, int minValue, int maxValue)
rulerWidth
- The width of drawn ruler, or -1 if you want to use the field mode.minValue
- The minimum possible value.maxValue
- The maximum possible value.Method Detail |
public void addValueChangeListener(ValueChangeListener listener)
listener
- The listener to add.public int getCursorPosition()
public javax.microedition.lcdui.Font getFont()
public int getMaxValue()
public int getMinValue()
public int getRulerWidth()
public int getValue()
public boolean isBoxOpaque()
public boolean isValueShown()
public void keyPressed(int keyCode, int gameAction)
keyPressed
in class Component
keyCode
- The key code.gameAction
- Game action corresponding to the key code.public void pointerPressed(int xpos, int ypos)
pointerPressed
in class Component
xpos
- The X position of pointer on parent Canvas.ypos
- The Y position of pointer on parent Canvas.public void removeValueChangListener(ValueChangeListener listener)
listener
- The listener to remove.public void setBackground(int red, int green, int blue)
setBackground
in class Component
red
- The red component of the color to set.green
- The green component of the color to set.blue
- The blue component of the color to set.public void setBorderColor(int red, int green, int blue)
red
- The red component of the color.green
- The green component of the color.blue
- The blue component of the color.public void setBoxOpaque(boolean boxOpaque)
boxOpaque
- Must be true to paint background of entry zone, and false to not paint it.public void setCursorColor(int red, int green, int blue)
red
- The red component of the color.green
- The green component of the color.blue
- The blue component of the color.public void setCursorPosition(int cursorPosition)
cursorPosition
- The cursor position. Must be zero for the cursor to be on the left.public void setDisabled(boolean disabled)
setDisabled
in class Component
disabled
- Must be true to disabled the component, and false enabled to enable it.public void setFieldBackground(int red, int green, int blue)
red
- The red component of the color.green
- The green component of the color.blue
- The blue component of the color.public void setFieldBackgroundOff(int red, int green, int blue)
red
- The red component of the color.green
- The green component of the color.blue
- The blue component of the color.public void setFocusColor(int red, int green, int blue)
setFocusColor
in class Component
red
- The red component of the color.green
- The green component of the color.blue
- The blue component of the color.public void setFont(javax.microedition.lcdui.Font font)
font
- The font to set.public void setLocation(int x, int y)
setLocation
in class Component
x
- The new x coordinate.y
- The new y coordinate.public void setMaximumSize(int width, int height)
setMaximumSize
in class Component
width
- The maximum width.height
- The maximum height.public void setOpaque(boolean opaque)
setOpaque
in class Component
opaque
- Must be true for the component to paint a background.public void setTextColor(int red, int green, int blue)
red
- The red component of the color.green
- The green component of the color.blue
- The blue component of the color.public void setTextColorOff(int red, int green, int blue)
red
- The red component of the color.green
- The green component of the color.blue
- The blue component of the color.public void setValue(int value)
value
- The value to set.public void setValueShown(boolean valueShown)
valueShown
- Must be true to show the value. Otherwise the value will not be displayed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |