英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论