SwingEventMonitor 发生了什么? [英] What happened to SwingEventMonitor?

查看:41
本文介绍了SwingEventMonitor 发生了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究放大用户界面的可能性.因此,我无法直接访问组件,必须在玻璃面板上捕获事件.

I'm working on a possibility to zoom into a UI. Therefore I can't access the components directly and have to catch the events on glasspane.

只要我不使用自动更新组件作为 JTextArea,这就可以正常工作.由于这是一项考试,我无法使用外部库进行缩放.

This works fine as long as I don't use auto-updating-components as JTextArea. Since this is an exam I can't use an external library for zooming.

插入符号更新是我的实际问题,因此我正在寻找一种无需将侦听器附加到组件即可获取所有事件的选项.

The caret updating is my actual problem, so I'm looking for an option to get all events without having to attach a listener to the component.

存在一个SwingEventMonitor 但我在 Java6 中找不到了.是刚刚重命名的班级吗?我可以通过 Toolkit.getToolkit().. 添加 AWTListener,但是因为 CaretEvent 是一个 SwingEvent,所以我似乎不能用这种方式来控制它.

There existed a SwingEventMonitor but I can't find it in Java6 anymore. Is the class just renamed? I can add AWTListener via Toolkit.getToolkit().. but since CaretEvent is a SwingEvent it seems like I can't cantch it this way.

推荐答案

不是很方便,但是可以拦截all AWTEvent 子类进入 EventQueue 通过推送自己的队列,如图 此处.

It's not as convenient, but you can intercept all AWTEvent subclasses entering the EventQueue by pushing your own queue, as shown here.

这篇关于SwingEventMonitor 发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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