Windows 7 触摸屏 + Java Swing = 延迟鼠标事件 [英] Windows 7 Touch Screen + Java Swing = Delayed Mouse Events

查看:36
本文介绍了Windows 7 触摸屏 + Java Swing = 延迟鼠标事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 Java 开发 Swing 应用程序.该程序将在专用的 Windows 7 触摸屏机器上运行,据我所知,在正常操作下,该程序应该是唯一在这些机器上运行的程序.

I am developing a Swing application in Java. The program is to be run on dedicated Windows 7 Touch Screen machines, and as far as I know, this program should be the only thing running on them under normal operation.

我注意到 Windows 7 的触摸屏界面有一个可以阻止 mousedown 事件的东西.由于点击并按住右键单击"手势,Windows 7 实际上不会向应用程序发送鼠标按下事件,直到:

I've noticed that Windows 7's touch screen interface has this thing where it will hold back mousedown events. Due to the "tap-and-hold right click" gesture, Windows 7 won't actually send the application a mouse down event until:

  • 用户触摸"(触摸时抬起手指,此时向下和向上发送)
  • 移动他们的手指(此时点击变成拖动)
  • 或右键单击圆圈手势超时(大约 5-6 秒后)

简单地说,这意味着在发送鼠标按下事件之前,应用程序上的按钮看起来不会被压低(并且永远不会通过快速点击来压低).但是,最近,更严重的是,这意味着需要长按的功能不可能在没有对普通用户造成严重混淆的情况下实现.

Trivially, this means that buttons don't look depressed on the application until the mouse down event is sent (and never draw depressed at all with a quick tap). But, recently, more seriously, this means functionality that requires a press-and-hold cannot happen without major amounts of confusion to the average user.

在开发的这个阶段,很远已经太晚了,要转身从头开始使用针对其他问题提供的众多触控库之一为时已晚.(他们需要在他们的组件层次结构中重做整个应用程序,这根本不可行.另外,使用鼠标事件编码的东西将不得不使用触摸事件重新编码,而我们并没有真正做到需要多点触控...)

At this point in development it is far too late to turn around and start from scratch with one of the many touch libraries offered on other questions. (They require redoing the entire application in their component hierarchy, and that simply isn't feasible. Plus things coded to use mouse events would then have to be recoded using touch events, and we don't really need multi-touch...)

是的,我曾尝试简单地关闭触摸并按住右键单击手势.不幸的是,这样做只是禁用了一个圆圈的绘制,该圆圈表示手指周围的右键单击手势以及随后的右键单击.它并没有消除潜在的问题:延迟鼠标按下事件长达 6 秒.

Yes, I have attempted to simply turn off the touch-and-hold right click gesture. Unfortunately, doing so simply disables the drawing of a circle indicating a right click gesture around your finger and the fire of the subsequent right click. It does NOT remove the underlying problem: the delayed mouse down event for up to six seconds.

我的问题:有没有办法:

  • 理想情况下,向 Windows 表明我的应用程序是可触摸的应用程序,因此它会立即发送事件(但是,我想,仍然发送鼠标事件而不是触摸事件)?我可以看到内置软键盘工作正常,似乎.我只希望我的 Java 应用程序也能这样做.
  • 在计算机上完全禁用延迟,但仍提供基本的触摸功能?
  • 可能像这个问题一样简单,其中似乎在问同样的现象,但在 Java 中?
  • Ideally, indicate to Windows that my application is a touch-ready application, so it sends down events immediately (but, I suppose, still send mouse events instead of touch events)? I can see that the built-in soft keyboard works correctly, it seems. I just want my Java application to do the same.
  • Disable the delay entirely on the computer, but still provide basic touch functionality?
  • Potentially something as simple as this question, which seems to be asking about the same phenomenon, but in Java?

推荐答案

通常,此类行为由安装在设备上的触摸设备驱动程序控制.我见过的所有触控制造商都有控制面板应用程序,可让您自定义触控行为.因此,例如,您可以告诉驱动程序在收到触摸后立即发送鼠标点击,而不是短暂延迟,以防止意外触摸引发输入事件.

Typically this type of behavior is controlled by the touch device driver installed on the device. All of the touch manufacturers I have seen have control panel apps that allow you to customize touch behavior. So for instance you can tell the driver to send a mouse click immediately up receipt of a touch rather than delaying briefly in order to prevent an incidental touch from initiating an input event.

这篇关于Windows 7 触摸屏 + Java Swing = 延迟鼠标事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆