| 
 | MIDP3.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.CanvasItem
public abstract class CanvasItem
 CanvasItem abstracts the generic features of its subclasses, such as TextEditor 
 component. Such features include setting the size and position component. Also 
 associating the item, such as TextEditor, with its parent, such as Canvas or 
 CustomItem, may be done through this API with setParent() method.
 
TextEditor, 
Canvas, 
CustomItem| Constructor Summary | |
|---|---|
| CanvasItem()Constructor for CanvasItem. | |
| Method Summary | |
|---|---|
|  int | getHeight()Gets the height of this CanvasItemin pixels. | 
|  java.lang.Object | getParent()Gets the parent object of this CanvasItem. | 
|  int | getPositionX()Gets the x-coordinate of the rendering position of this CanvasItem. | 
|  int | getPositionY()Gets the y-coordinate of the rendering position of this CanvasItem. | 
|  int | getWidth()Gets the width of this CanvasItemin pixels. | 
|  int | getZPosition()Gets the Z-position, or the elevation, of the item. | 
|  void | setParent(java.lang.Object parent)Sets the parent object of this CanvasItem. | 
|  void | setPositionX(int x)Sets the x-coordinate of the rendering position of this CanvasItem. | 
|  void | setPositionY(int y)Sets the y-coordinate of the rendering position of this CanvasItem. | 
|  void | setSize(int width,
        int height)Sets the size of this CanvasItemin pixels. | 
|  void | setVisible(boolean visible)Sets the visibility value of the CanvasItem. | 
|  void | setZPosition(int z)Sets the Z-position, or the elevation, of the item. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public CanvasItem()
 Constructor for CanvasItem.
 
| Method Detail | 
|---|
public void setParent(java.lang.Object parent)
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 
             parentpublic java.lang.Object getParent()
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 setPositionX(int x)
 Sets the x-coordinate of the rendering position of this CanvasItem. 
 The origin is relative to the coordinate system of the 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.
 
x - the x coordinate of the anchor point, in pixels.public void setPositionY(int y)
 Sets the y-coordinate of the rendering position of this CanvasItem. 
 The origin is relative to the coordinate system of the 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.
 
y - the y coordinate of the anchor point, in pixels.public int getPositionX()
CanvasItem.
 The origin is relative to the coordinate system of the parent.
public int getPositionY()
CanvasItem.
 The origin is relative to the coordinate system of the parent.
public void setVisible(boolean visible)
Sets the visibility value of the CanvasItem. Initially the CanvasItem is not visible so it must be explicitly set to visible in order it to appear on the user interface.
If the CanvasItem is already visible, calling setVisible(true) does nothing. If the editor is already hidden calling setVisible(false) does nothing.
visible - true to set visible, false to set invisible
java.lang.IllegalStateException - if the item is not added to any parentpublic 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.
Modifying Z-value of an item should not impact Z-position of other items, so there may be items with the same Z-position. 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. However if setZPosition has been called before calling setParent then setting the parent does not change the already set Z-position of this CanvasItem.
z - the Z-position of the item
java.lang.IllegalArgumentException - if z < 0public int getZPosition()
| 
 | MIDP3.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||