Skip to main content

JME support for touch screen and vibration

3 replies [Last post]
rogersilva
Offline
Joined: 2007-06-15
Points: 0

Hi all, How are you?
I need to develop a application for mobile phone, and it is going to use the mobile touch screen and vibration features.
Does somebody know if there is an JME API, or JSR that provides access/control to Mobile's touch screen and vibration features?
Does somebody know if it is feasible to do it using JME?

I appreciate any help you can give,
thanks in advance,
Roger

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
terrencebarr
Offline
Joined: 2004-03-04
Points: 0

Sorry for the slow reply. I was hoping someone else could answer this.

The paint method in Item is package protected so you cannot call it directly. It is called from the MIDP subsystem on the paint thread as needed. This means that you can't use an Item as part of a CustomItem. A CustomItem contains elements that you implement yourself and you can paint yourself.

-- Terrence

terrencebarr
Offline
Joined: 2004-03-04
Points: 0

Hi,

For touchscreen support check the MIDP Canvas class methods pointerpressed(), etc.

For vibration support see the MIDP Displayable class (example: http://wiki.forum.nokia.com/index.php/How_to_vibrate_phones_from_Java_ME)

Hope this helps,

-- Terrence

rogersilva
Offline
Joined: 2007-06-15
Points: 0

Hi,
thanks a lot for helping.
I need to include the behavior described bellow to all Item subclasses:
pointerPressed(int x, int y)
pointerReleased(int x, int y)
pointerDragged(int x, int y)

I've tried to create a CustomItem for each Item subclass with an attribute that It represents, for instance:
class Test extends CustomItem{
Item obj;

protected void paint(Graphics arg0, int arg1, int arg2) {
obj.paint() // ?
}

}

However, I don't know which Item's class method to call in order to paint it.
Please, Do you have any idea on how I can do that??

thanks in advance,
Roger