• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mouse support in J2ME?

 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jonathan Knudsen
Author
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there some idiomatic equivalent on a cell phone that doesn't have a touch-sensitive screen?
 
Jonathan Knudsen
Author
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic