palmed.edit.scrollbar
Class VerticalScrollbar

java.lang.Object
  extended by palmed.edit.scrollbar.VerticalScrollbar
All Implemented Interfaces:
IDrawer, IScrollable, IScrollbar, IScrollView, IComponent

public final class VerticalScrollbar
extends java.lang.Object
implements IScrollbar, IScrollable, IDrawer, IScrollView, IComponent

This class provides a vertical scrollbar.

Version:
$Revision$ $Date$
Author:
Mathieu Champlon

Constructor Summary
VerticalScrollbar(IViewport viewport)
          Create a vertical scrollbar.
 
Method Summary
 boolean click(int x, int y)
          Handle a click event.
 void drag(int x, int y)
          Handle a drag event.
 void drawArrow(javax.microedition.lcdui.Graphics g, int end, int from, int to)
          Draw an arrow.
 void drawBackground(javax.microedition.lcdui.Graphics g, int size, int width)
          Draw the background.
 void drawBody(javax.microedition.lcdui.Graphics g, int start, int end, int from, int to)
          Draw the body.
 void drawCursor(javax.microedition.lcdui.Graphics g, int start, int width, int from, int length)
          Draw the cursor.
 int getHeight()
          Retrieve the current height.
 int getLayout()
          Retrieve the layout.
 int getWidth()
          Retrieve the current width.
 void paint(javax.microedition.lcdui.Graphics g)
          Paint the component.
 void resize(int width, int height)
          Request a component resize.
 void scroll(int steps)
          Scroll the component.
 void scrolled(Coordinate position)
          The content has scrolled to the given position.
 void unclick(int x, int y)
          Handle an unclick event.
 void update(int visible, int max)
          Change the length of the cursor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VerticalScrollbar

public VerticalScrollbar(IViewport viewport)
Create a vertical scrollbar.

Parameters:
viewport - the viewport to manage
Method Detail

paint

public void paint(javax.microedition.lcdui.Graphics g)
Paint the component.

Specified by:
paint in interface IComponent
Parameters:
g - the graphics

update

public void update(int visible,
                   int max)
Change the length of the cursor.

Specified by:
update in interface IScrollbar
Parameters:
visible - the number of visible elements
max - the total number of elements

resize

public void resize(int width,
                   int height)
Request a component resize.

Specified by:
resize in interface IComponent
Parameters:
width - the new width
height - the new height

click

public boolean click(int x,
                     int y)
Handle a click event.

Specified by:
click in interface IComponent
Parameters:
x - the pointer abscissa
y - the pointer ordinate
Returns:
whether the component claims focus or not

drag

public void drag(int x,
                 int y)
Handle a drag event.

The component must have claimed focus upon click in order to receive this event.

Specified by:
drag in interface IComponent
Parameters:
x - the pointer abscissa
y - the pointer ordinate

unclick

public void unclick(int x,
                    int y)
Handle an unclick event.

The component must have claimed focus upon click ini order to receive this event.

Specified by:
unclick in interface IComponent
Parameters:
x - the pointer abscissa
y - the pointer ordinate

scrolled

public void scrolled(Coordinate position)
The content has scrolled to the given position.

Specified by:
scrolled in interface IScrollView
Parameters:
position - the upper-left content position

scroll

public void scroll(int steps)
Scroll the component.

Specified by:
scroll in interface IScrollable
Parameters:
steps - the number of steps to scroll

drawArrow

public void drawArrow(javax.microedition.lcdui.Graphics g,
                      int end,
                      int from,
                      int to)
Draw an arrow.

Specified by:
drawArrow in interface IDrawer
Parameters:
g - the graphics
end - the offset where to end at perpendiculary of the axis of the scrollbar
from - the offset where to start at on the axis of the scrollbar
to - the offset where to end at on the axis of the scrollbar

drawBody

public void drawBody(javax.microedition.lcdui.Graphics g,
                     int start,
                     int end,
                     int from,
                     int to)
Draw the body.

Specified by:
drawBody in interface IDrawer
Parameters:
g - the graphics
start - the offset where to start at perpendiculary of the axis of the scrollbar
end - the offset where to end at perpendiculary of the axis of the scrollbar
from - the offset where to start at on the axis of the scrollbar
to - the offset where to end at on the axis of the scrollbar

drawCursor

public void drawCursor(javax.microedition.lcdui.Graphics g,
                       int start,
                       int width,
                       int from,
                       int length)
Draw the cursor.

Specified by:
drawCursor in interface IDrawer
Parameters:
g - the graphics
start - the offset to start at perpendiculary of the axis of the scrollbar
width - the width of the cursor
from - the offset to start at on the axis of the scrollbar
length - the length of the cursor

drawBackground

public void drawBackground(javax.microedition.lcdui.Graphics g,
                           int size,
                           int width)
Draw the background.

Specified by:
drawBackground in interface IDrawer
Parameters:
g - the graphics
size - the size of the scrollbar
width - the width of the scrollbar

getLayout

public int getLayout()
Retrieve the layout.

Supported layouts are :

Specified by:
getLayout in interface IComponent
Returns:
a combination of layout flags

getWidth

public int getWidth()
Retrieve the current width.

Specified by:
getWidth in interface IComponent
Returns:
the width in pixels

getHeight

public int getHeight()
Retrieve the current height.

Specified by:
getHeight in interface IComponent
Returns:
the height in pixels


Copyright © 2004-2006 PalmEd. All Rights Reserved.