本文整理汇总了Java中java.awt.event.MouseEvent.MOUSE_LAST属性的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.MOUSE_LAST属性的具体用法?Java MouseEvent.MOUSE_LAST怎么用?Java MouseEvent.MOUSE_LAST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.MOUSE_LAST属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: acceptEvent
public FilterAction acceptEvent(AWTEvent event) {
if (modalComponent != null) {
int eventID = event.getID();
boolean mouseEvent = (eventID >= MouseEvent.MOUSE_FIRST) &&
(eventID <= MouseEvent.MOUSE_LAST);
boolean actionEvent = (eventID >= ActionEvent.ACTION_FIRST) &&
(eventID <= ActionEvent.ACTION_LAST);
boolean windowClosingEvent = (eventID == WindowEvent.WINDOW_CLOSING);
/*
* filter out MouseEvent and ActionEvent that's outside
* the modalComponent hierarchy.
* KeyEvent is handled by using enqueueKeyEvent
* in Dialog.show
*/
if (Component.isInstanceOf(modalComponent, "javax.swing.JInternalFrame")) {
/*
* Modal internal frames are handled separately. If event is
* for some component from another heavyweight than modalComp,
* it is accepted. If heavyweight is the same - we still accept
* event and perform further filtering in LightweightDispatcher
*/
return windowClosingEvent ? FilterAction.REJECT : FilterAction.ACCEPT;
}
if (mouseEvent || actionEvent || windowClosingEvent) {
Object o = event.getSource();
if (o instanceof sun.awt.ModalExclude) {
// Exclude this object from modality and
// continue to pump it's events.
return FilterAction.ACCEPT;
} else if (o instanceof Component) {
Component c = (Component) o;
// 5.0u3 modal exclusion
boolean modalExcluded = false;
if (modalComponent instanceof Container) {
while (c != modalComponent && c != null) {
if ((c instanceof Window) &&
(sun.awt.SunToolkit.isModalExcluded((Window)c))) {
// Exclude this window and all its children from
// modality and continue to pump it's events.
modalExcluded = true;
break;
}
c = c.getParent();
}
}
if (!modalExcluded && (c != modalComponent)) {
return FilterAction.REJECT;
}
}
}
}
return FilterAction.ACCEPT;
}