开发者

Java; Component.enableEvents ( ... ) does not work?

Recently, I discovered the Component.enableEvents ( ... ) method. The way that I would imagine that it would work would be that Component.enableEvents ( MouseEvent.MOUSE_PRESSED ) would only alert me if that specific event happened. However, it does not work like that, or I just cannot figure it out.

Right now, I have this code:

frame.enableEvents(FocusEvent.FOCUS_GAINED | FocusEvent.FOCUS_LOST | ComponentEvent.COMPONENT_RESIZED);

Bu开发者_Go百科t I still find that I get component moved events, component hidden, etc. What am I doing wrong?


From the JavaDoc for that method:

This method only needs to be invoked by subclasses of Component which desire to have the specified event types delivered to processEvent regardless of whether or not a listener is registered.

This says nothing about filtering out event types that are not named.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜