获取当前鼠标位置

发布于 2024-12-05 02:38:53 字数 230 浏览 0 评论 0原文

这似乎是一个简单的任务,但我正在查看几十个论坛,但还没有找到解决方案。如何获取 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

万劫不复 2024-12-12 02:38:53

在LWUIT中,您可以使用pointerListener注册您的Form:yourForm.addPointerPressedListener(this);,然后实现public void pointerPressed(int x, int y)的代码方法。 xy 是您要查找的位置。所以你必须点击屏幕才能获得这些值,即该设备是触觉设备。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文