获取当前鼠标位置
这似乎是一个简单的任务,但我正在查看几十个论坛,但还没有找到解决方案。如何获取 LWUIT 中当前鼠标位置?
只是这里是:
PointerInfo a = MouseInfo.getPointerInfo ();
Point point = new Point (a.getLocation ());
但是它不适合JavaME。
还有其他方法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在LWUIT中,您可以使用pointerListener注册您的Form:
yourForm.addPointerPressedListener(this);
,然后实现public void pointerPressed(int x, int y)
的代码方法。x
和y
是您要查找的位置。所以你必须点击屏幕才能获得这些值,即该设备是触觉设备。In LWUIT you can register your Form with the pointerListener :
yourForm.addPointerPressedListener(this);
, then you implement the code of thepublic void pointerPressed(int x, int y)
method. And thex
andy
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.