简体   繁体   English

swing 应用程序中丢失键盘和鼠标事件

[英]Losing keyboard and mouse events in swing application

I am participting in development of a Swing application that has a very complex class structure due to supporting different graphic styles.我正在参与开发一个 Swing 应用程序,由于支持不同的图形 styles,该应用程序具有非常复杂的 class 结构。 There are a few cases where mouse and keyboard events disappear somewhere in the window chain.在某些情况下,鼠标和键盘事件会在 window 链中的某处消失。 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).我尝试通过向我能找到的每个 Listener class 添加日志记录来找到它们,但我仍然不知道它们在哪里被捕获和处理(或丢失)。 Coming from Win32 and SWT development, I would simply start Winspector Spy and find this out by tracking through the native widgets.来自 Win32 和 SWT 开发,我只需启动 Winspector Spy 并通过跟踪本机小部件来发现这一点。 But this is not possbile in Swing.但这在 Swing 中是不可能的。

What can I do?我能做些什么? Is there something like Winspector which works for Swing applications?是否有类似 Winspector 的东西适用于 Swing 应用程序? Or is there a central point in a swing application where I can add debugging and figure out where the events go?或者在 swing 应用程序中是否有一个中心点,我可以在其中添加调试并找出事件 go 的位置?

What @camickr suggested in the comment about using the global event listener described @camickr 在评论中关于使用所描述的全局事件侦听器的建议
in this article 在本文中
did assist greatly in figuring out the UI hierarchy of that old project.确实有助于弄清楚那个旧项目的 UI 层次结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM