HuyPV
Tuesday, January 11, 2011
The get
methods for minimum and preferred width and height are defined abstract in the CustomItem
, so I have to implement them. In these methods I can either calculate or directly define the minimum and preferred width and height of each item. Another option that I have not utilized in this example would let me handle size change within the item, such as when the system reduces or expands the size of the available screen. The sizeChanged()
method takes parameters that allow the application to redraw an item as its given size changes.
paint()
is an abstract method whose job it is to paint the content of an item. The translation is set so that the upper left corner of my new item is at (0,0), so the application must paint every pixel within the item's area.
The traverse()
method is called by the system whenever the user moves the cursor within or into the CheckItem
. The traverse()
method will return true
if the traversal is internal and false
if it should proceed out to another item in the form. Depending on the value returned, traverse()
will either activate the item or just move the cursor around within the item. The method's parameters indicate the direction of traversal, the size of the viewable area, and other information about the area. It will be up to you to define when the traverse()
method should return false
, resulting in the activation of the next item on the form.
Title:
How to implement CustomItem in J2ME
Description:
The get methods for minimum and preferred width and height are defined abstract in the CustomItem , so I have to implement them. In these...
...
Rating:
4