|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--waba.ui.Control | +--waba.ui.Container | +--waba.ui.ScrollBar
ScrollBar is a simple implementation of a Scrollbar. The scroll bar orientation can be horizontal or vertical. Here is an example of how to use it.
// declarations ScrollBar sb1; ScrollBar sb2; ScrollBar sb3; ScrollBar sb4; // init public void testScrollBars() { add(sb1 = new ScrollBar(ScrollBar.VERTICAL)); sb1.setRect(RIGHT, CENTER, PREFERRED, waba.sys.Settings.screenHeight/2); add(sb2 = new ScrollBar(ScrollBar.VERTICAL)); sb2.setRect(BEFORE, SAME, PREFERRED, SAME); sb2.setLiveScrolling(true); add(sb3 = new ScrollBar(ScrollBar.HORIZONTAL)); sb3.setRect(LEFT,CENTER,waba.sys.Settings.screenWidth/2, PREFERRED); add(sb4 = new ScrollBar(ScrollBar.HORIZONTAL)); sb4.setRect(SAME, AFTER, SAME, PREFERRED); } public void onEvent(Event event) { if (event.type == ControlEvent.PRESSED && event.target == sb2) { int value = sb2.getValue(); sb1.setValue(value); sb3.setValue(value); sb4.setValue(value); } }
Field Summary | |
static byte |
HORIZONTAL
To be passed in the constructor |
static byte |
VERTICAL
To be passed in the constructor |
Fields inherited from class waba.ui.Container |
BORDER_LOWERED,
BORDER_NONE,
BORDER_RAISED,
BORDER_SIMPLE,
children,
lastH,
lastW,
lastX,
lastY,
parentWindow,
tail |
Fields inherited from class waba.ui.Control |
AFTER,
appId,
asContainer,
asWindow,
backColor,
backDis,
BEFORE,
BOTTOM,
CENTER,
enabled,
FILL,
FIT,
fm,
fmH,
focusLess,
font,
foreColor,
foreDis,
height,
LEFT,
parent,
PREFERRED,
RANGE,
RIGHT,
SAME,
TOP,
visible,
width,
x,
x2,
y,
y2 |
Constructor Summary | |
ScrollBar()
Creates Scrollbar with default values: maximum = 100 minimum = 0 orientation = VERTICAL blockIncrement = 10 unitIncrement = 1 value = 0 visibleItems = 10 |
|
ScrollBar(byte orientation)
|
Method Summary | |
int |
getBlockIncrement()
Get the items to increment by clicking the above the scrollbar |
int |
getMaximum()
Get the maximum of elements |
int |
getMinimum()
Get the minimum of elements |
int |
getPreferredHeight()
If this is a horizontal scroll bar, i strongly suggest you use PREFERRED in your control's height |
int |
getPreferredWidth()
If this is a vertical scroll bar, i strongly suggest you use PREFERRED in your control's width. |
int |
getUnitIncrement()
Get the items to increment by clicking the above the scrollbar |
int |
getValue()
Get the value. |
int |
getVisibleItems()
Get the count of visible items for the scrollbar |
protected void |
onBoundsChanged()
Called after an setRect. |
protected void |
onColorsChanged(boolean colorsChanged)
Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. |
void |
onEvent(Event event)
Called to process key, pen, control and other posted events. |
void |
onPaint(Graphics g)
Draws the border (if any). |
void |
setBlockIncrement(int i)
Set the items to increment by clicking the above the scrollbar. |
void |
setEnabled(boolean enabled)
sets if this container and all childrens can or not accept events |
void |
setLiveScrolling(boolean liveScrolling)
Set the live scrolling. |
void |
setMaximum(int i)
Set the maximum of elements |
void |
setMinimum(int i)
Set the minimum of elements |
void |
setUnitIncrement(int i)
Set the items to increment by clicking the up button |
void |
setValue(int i)
Set the value if visibleItems+i+minimum <= maximum. |
void |
setValues(int newValue,
int newVisibleItems,
int newMinimum,
int newMaximum)
Sets the value, visibleItems, minimum and maximum values |
void |
setVisibleItems(int i)
Set the count of visible items for the scrollbar. |
Methods inherited from class waba.ui.Container |
add,
add,
add,
broadcastEvent,
findChild,
getChildren,
getClientRect,
onStart,
paintChildren,
remove,
setBorderStyle |
Methods inherited from class waba.ui.Control |
addTimer,
contains,
createGraphics,
getAbsoluteRect,
getBackColor,
getFont,
getFontMetrics,
getForeColor,
getNext,
getParent,
getParentWindow,
getPos,
getRect,
getSize,
isDisplayed,
isEnabled,
isVisible,
onFontChanged,
onWindowPaintFinished,
postEvent,
removeTimer,
repaint,
repaintNow,
requestFocus,
setBackColor,
setBackForeColors,
setFocusLess,
setFont,
setForeColor,
setRect,
setRect,
setRect,
setVisible |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
toString,
wait,
wait |
Field Detail |
public static final byte VERTICAL
public static final byte HORIZONTAL
Constructor Detail |
public ScrollBar()
public ScrollBar(byte orientation)
Method Detail |
public void setValues(int newValue, int newVisibleItems, int newMinimum, int newMaximum)
public void setMaximum(int i)
public int getMaximum()
public void setMinimum(int i)
public int getMinimum()
public void setBlockIncrement(int i)
public int getBlockIncrement()
public void setUnitIncrement(int i)
public int getUnitIncrement()
public void setValue(int i)
public int getValue()
public void setVisibleItems(int i)
public int getVisibleItems()
public void setLiveScrolling(boolean liveScrolling)
public void onEvent(Event event)
event
- the event to processEvent
,
KeyEvent
,
PenEvent
public void setEnabled(boolean enabled)
protected void onColorsChanged(boolean colorsChanged)
public void onPaint(Graphics g)
super.onPaint(g);
, or the border will not be drawn.g
- the graphics object for drawingGraphics
public int getPreferredWidth()
public int getPreferredHeight()
protected void onBoundsChanged()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |