|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nokia.mid.ui.CanvasItem
public abstract class CanvasItem
Parent object just for components on Canvas. Currently there are two
components: CanvasGraphicsItem
and TextEditor
.
Methods of CanvasItem are implemented in subclasses
CanvasGraphicsItem
and TextEditor
.
Constructor Summary | |
---|---|
CanvasItem()
|
Method Summary | |
---|---|
int |
getHeight()
Gets the height of this CanvasItem in pixels. |
java.lang.Object |
getParent()
Get the parent object of this CanvasItem or null, if no
parent set. |
int |
getPositionX()
Gets the rendering position of this CanvasItem . |
int |
getPositionY()
Sets the rendering position of this CanvasItem . |
int |
getWidth()
Gets the width of this CanvasItem in pixels. |
int |
getZPosition()
Returns the Z-position, or the elevation, of the item. |
boolean |
isVisible()
Returns the visibility value of CanvasItem . |
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 |
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CanvasItem()
Method Detail |
---|
public void setParent(java.lang.Object parent)
CanvasItem
.
Typically the parent object would be Canvas
. Setting the
parameter to null removes the association to the parent. If
setParent(null)
is called for a CanvasItem
yet
not having any parent or setParent(parent)
is called with
the same parent, the call is silently ignored.
parent
- the parent object
java.lang.IllegalArgumentException
- if parent
is not a valid object with which a
CanvasItem
can be associated, or if CanvasItem
is already set to another another parentpublic java.lang.Object getParent()
CanvasItem
or null, if no
parent set.
setParent(java.lang.Object parent )
public void setSize(int width, int height)
CanvasItem
in pixels.
width
- width in pixelsheight
- height in pixels
java.lang.IllegalArgumentException
- if the width or height is less than one pixelpublic int getHeight()
CanvasItem
in pixels.
public int getWidth()
CanvasItem
in pixels.
public void setPosition(int x, int y)
Sets the rendering position of this CanvasItem
. The origin
is relative to the coordinate system of parent.
The CanvasItem
may be placed fully off or partially of the
visible area of the parent by the setPosition
method; in
this case the CanvasItem
is just partly visible.
x
- the x coordinate of the anchor point, in pixels.y
- the y coordinate of the anchor point, in pixels.public int getPositionX()
Gets the rendering position of this CanvasItem
.
The origin is relative to the coordinate system of parent.
public int getPositionY()
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.
public void setVisible(boolean visible)
Sets the visibility value of CanvasItem
.
CanvasItem
is not visible so it must be explicitly
set to visible in order it to appear on UI.
If the item is already visible calling setVisible(true)
does
nothing. If the item is not visible calling
setVisible(false)
does nothing.
visible
- visibility of the CanvasItem
java.lang.IllegalStateException
- If the item is not added to any parentpublic boolean isVisible()
Returns 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.
setVisible(boolean visible )
public void setZPosition(int z)
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.
The z-position is unique for each item meaning that changing a Z-position of an item may change the Z-position of the items that share the same parent item. The Z-position does not affect the item's size in any way.
When items are added with setParent(java.lang.Object)
they will get a
Z-position that is increased by 1 from the item that is the top most item
at that time.
z
- the z position of the item.
java.lang.IllegalArgumentException
- if z
< 0getZPosition()
public int getZPosition()
Returns the Z-position, or the elevation, of the item. The Z-position decides the stacking order of neighboring items.
setZPosition(int)
|
forum.nokia.com/java | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |