|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nokia.mid.ui.CanvasItem com.nokia.mid.ui.CanvasGraphicsItem
A paintable item that can be used on top of Canvas or CustomItem
Field Summary |
Fields inherited from class com.nokia.mid.ui.CanvasItem |
SCALE_AVERAGE, SCALE_NEAREST, SCALE_NOT_ALLOWED |
Constructor Summary | |
CanvasGraphicsItem(int width,
int height)
Creates a new CanvasGraphicsItem object with the given initial size. |
Method Summary | |
int |
getContentHeight()
Gets the content's height in pixels. |
int |
getContentWidth()
Gets the content's width in pixels. |
protected abstract void |
paint(javax.microedition.lcdui.Graphics g)
Renders the CanvasGraphicsItem. |
void |
repaint()
Requests a repaint for the entire CanvasGraphicsItem. |
void |
repaint(int x,
int y,
int w,
int h)
Requests a repaint for the specified region of the CanvasGraphicsItem. |
void |
setParent(java.lang.Object parent)
Set the parent object of this CanvasItem. |
void |
setPosition(int x,
int y)
Sets the rendering position of this CanvasItem . |
void |
setSize(int width,
int height)
Sets the size of this CanvasItem in pixels. |
void |
setSize(int x,
int y,
int width,
int height)
Sets the size of the CanvasItem 's container in pixels. |
void |
setVisible(boolean visible)
Sets the visibility value of CanvasItem . |
void |
setZPosition(int z)
Sets the Z-position, or the elevation, of the item. |
Methods inherited from class com.nokia.mid.ui.CanvasItem |
getHeight, getParent, getPositionX, getPositionY, getWidth, getZPosition, isVisible, scale, scale, setScalingMode |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CanvasGraphicsItem(int width, int height)
width
- the width of the item in pixelsheight
- the height of the item in pixel
java.lang.IllegalArgumentException
- if with or height are smaller than 1Method Detail |
protected abstract void paint(javax.microedition.lcdui.Graphics g)
g
- the Graphics object to be used for rendering the Canvaspublic void repaint()
public void repaint(int x, int y, int w, int h)
x
- the x coordinate of the rectangle to be repaintedy
- the y coordinate of the rectangle to be repaintedw
- the width of the rectangle to be repaintedh
- the height of the rectangle to be repaintedpublic void setParent(java.lang.Object parent)
CanvasItem
setParent
in class CanvasItem
parent
- the parent objectpublic void setVisible(boolean visible)
CanvasItem
Sets the visibility value of CanvasItem
. Initially
CanvasItem is not visible so it must be explicitly set to visible
in order it to appear on UI.
If the editor is already visible calling setVisible(true) does nothing. If the item is not visible calling setVisible(false) does nothing.
setVisible
in class CanvasItem
public void setSize(int x, int y, int width, int height)
CanvasItem
's container in pixels.
setSize
in class CanvasItem
x
- the x coordinate of the anchor pointy
- the y coordinate of the anchor pointwidth
- the new width in pixelsheight
- the new height in pixelsCanvasItem.setPosition(int, int)
,
CanvasItem.setSize(int, int)
public void setSize(int width, int height)
CanvasItem
CanvasItem
in pixels.
setSize
in class CanvasItem
width
- width in pixelsheight
- height in pixelsfor more details
public void setPosition(int x, int y)
CanvasItem
Sets the rendering position of this CanvasItem
. The origin is
relative to the coordinate system of parent.
The CanvasItem
may be placed partially or fully off of the visible area
of the parent by the setPosition
method; in this case the CanvasItem is just not fully visible.
setPosition
in class CanvasItem
x
- the x coordinate of the anchor point, in pixels.y
- the y coordinate of the anchor point, in pixels.public int getContentWidth()
CanvasItem.getWidth()
.
public int getContentHeight()
CanvasItem.getHeight()
.
public void setZPosition(int z)
CanvasItem
Sets the Z-position, or the elevation, of the item. The elevation decides the stacking order of neighboring items. An item of high Z-position will be drawn on top of an item with a lower Z-position if they share the same parent item. Other items that share the same Z-position will be drawn in an undefined order, although the order will stay the same for as long as the items live. The Z-position does not affect the item's size in any way. When items are added with setParent they will get a Z-position that is increased by 1 from the previously added item.
setZPosition
in class CanvasItem
z
- the z position of the item.CanvasItem.getZPosition()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |