This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes Mouse support in J2ME? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Reply Bookmark "Mouse support in J2ME?" Watch "Mouse support in J2ME?" New topic
Author

Mouse support in J2ME?

Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 609
A couple of years ago I played with writing a Java app for my Palm IIIx and one of the useful things was being able to detect the equivalent of mouseDown, mouseMove, and mouseUp events.
Is there support for such things in MIDP 2.0?


SCJP, SCJD, SCEA 5 "The only rules that really matter are these: what a man can do and what a man can't do." Captain Jack Sparrow
Jonathan Knudsen
Author
Ranch Hand

Joined: Apr 22, 2003
Posts: 55
MIDP 1.0 supports pointer events, but it depends on the device. Most cell phones don't have touch screens, but there are a few exceptions: Palm OS devices, Sony Ericsson P800, possibly others.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Jonathan Knudsen:
MIDP 1.0 supports pointer events, but it depends on the device.

What would be the preferred way and location for testing whether a pointer is available/supported by the handheld? Will this change with MIDP 2.0?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 609
Is there some idiomatic equivalent on a cell phone that doesn't have a touch-sensitive screen?
Jonathan Knudsen
Author
Ranch Hand

Joined: Apr 22, 2003
Posts: 55
You can find out whether pointer events are supported by calling the hasPointerEvents() and hasMotionPointerEvents() in the Canvas class. If these are supported, then your Canvas subclass will be notified via the pointerPressed(), pointerReleased(), and pointerDragged() methods in Canvas.
If pointer events are crucial to your application but not supported on the device, you will need to provide an alternate method of input, probably based on keys.
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 609
Jonathan,
Thanks for the quick response. I appreciate it.
If I don't win a copy of your book, I'll probably have to go out and buy one.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Mouse support in J2ME?
 
Similar Threads
scjp 5.0
Why isnt My Mock Exam put on scwcd links
AJAX & Flash
how, possibly, to encapsulate at the level of objects?
JSF Components for JMX