It would seem a simple task, but I'm looking at a couple pair tens forums and haven't found the solution. How can I get the current mouse position in LWUIT?
Only here it is:
PointerInfo a = MouseInfo.getPointerInfo ();
Point point = new Point (a.getLocation ());
But it is not suitable for JavaME.
Are there other ways?
In LWUIT you can register your Form with the pointerListener : yourForm.addPointerPressedListener(this);
, then you implement the code of the public void pointerPressed(int x, int y)
method. And the x
and y
are the position you are looking for. So you must click the screen to obtain these values , that is the device is a tactile one.