失去 Swing 应用程序中的键盘和鼠标事件

huangapple go评论62阅读模式
英文:

Losing keyboard and mouse events in swing application

问题

我正在参与开发一个Swing应用程序,由于需要支持不同的图形样式,所以它具有非常复杂的类结构。
有一些情况下,鼠标和键盘事件在窗口链的某个地方消失了。
我尝试通过向我能找到的每个Listener类添加日志记录来查找它们,但是我仍然不知道它们被捕获和处理(或丢失)在哪里。
来自Win32和SWT开发的经验告诉我,我只需启动Winspector Spy,并通过跟踪本机部件来找到问题所在。但是在Swing中,这是不可能的。

我该怎么办?
是否有类似于Winspector的工具适用于Swing应用程序?
或者在Swing应用程序中是否有一个中心点可以添加调试代码,从而找出事件的去向?

英文:

I am participting in development of a Swing application that has a very complex class structure due to supporting different graphic styles.
There are a few cases where mouse and keyboard events disappear somewhere in the window chain.
I tried finding them by adding logging to every Listener class I could find, but still, I dont know where they are being caught and processed (or lost).
Coming from Win32 and SWT development, I would simply start Winspector Spy and find this out by tracking through the native widgets. But this is not possbile in Swing.

What can I do?
Is there something like Winspector which works for Swing applications?
Or is there a central point in a swing application where I can add debugging and figure out where the events go?

答案1

得分: 0

在评论中@camickr提到的关于使用全局事件监听器的建议,在这篇文章中有描述,对于理清那个旧项目的UI层次结构帮助很大。

英文:

What @camickr suggested in the comment about using the global event listener described
in this article
did assist greatly in figuring out the UI hierarchy of that old project.

huangapple
  • 本文由 发表于 2020年4月10日 17:41:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/61137638.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定