调度MouseEvent [英] Dispatch MouseEvent

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

问题描述

有没有一种方法可以使用MouseEvent分发MouseEvent,与dispatchKeyEvent相同 KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(listener); 在事件转移到组件之前发生了什么?

Is there a way to dispatch MouseEvent, same as dispatchKeyEvent using the KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(listener); that happens before the event transferred to the component ?

我知道我有2个选择

1)将鼠标事件添加到所有递归组件

1) add mouse event to all compoenents recursive

2)使用透明玻璃片

Java是否支持此功能,还是我必须使用上述选项之一?

Does Java support this , or do I have to use the one of the options above?

谢谢

推荐答案

我终于做了

long  eventMask = AWTEvent.MOUSE_MOTION_EVENT_MASK
         + AWTEvent.MOUSE_EVENT_MASK;
Toolkit.getDefaultToolkit().addAWTEventListener(
         new MouseListener(){....}, eventMask);

谢谢你

这篇关于调度MouseEvent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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