java.awt.event.MouseEvent#MOUSE_FIRST源码实例Demo

下面列出了java.awt.event.MouseEvent#MOUSE_FIRST 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

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;
}
 
源代码2 项目: dragonwell8_jdk   文件: EventDispatchThread.java
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;
}
 
源代码3 项目: TencentKona-8   文件: EventDispatchThread.java
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;
}
 
源代码4 项目: jdk8u60   文件: EventDispatchThread.java
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;
}
 
源代码5 项目: JDKSourceCode1.8   文件: EventDispatchThread.java
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;
}
 
源代码6 项目: openjdk-jdk8u   文件: EventDispatchThread.java
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;
}
 
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;
}
 
源代码8 项目: Bytecoder   文件: EventDispatchThread.java
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;
}
 
源代码9 项目: Bytecoder   文件: Toolkit.java
public void eventDispatched(AWTEvent event) {
    long eventBit = 0; // Used to save the bit of the event type.
    if (((eventBit = eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0 &&
         event.id >= ComponentEvent.COMPONENT_FIRST &&
         event.id <= ComponentEvent.COMPONENT_LAST)
     || ((eventBit = eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0 &&
         event.id >= ContainerEvent.CONTAINER_FIRST &&
         event.id <= ContainerEvent.CONTAINER_LAST)
     || ((eventBit = eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0 &&
         event.id >= FocusEvent.FOCUS_FIRST &&
         event.id <= FocusEvent.FOCUS_LAST)
     || ((eventBit = eventMask & AWTEvent.KEY_EVENT_MASK) != 0 &&
         event.id >= KeyEvent.KEY_FIRST &&
         event.id <= KeyEvent.KEY_LAST)
     || ((eventBit = eventMask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0 &&
         event.id == MouseEvent.MOUSE_WHEEL)
     || ((eventBit = eventMask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0 &&
         (event.id == MouseEvent.MOUSE_MOVED ||
          event.id == MouseEvent.MOUSE_DRAGGED))
     || ((eventBit = eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0 &&
         event.id != MouseEvent.MOUSE_MOVED &&
         event.id != MouseEvent.MOUSE_DRAGGED &&
         event.id != MouseEvent.MOUSE_WHEEL &&
         event.id >= MouseEvent.MOUSE_FIRST &&
         event.id <= MouseEvent.MOUSE_LAST)
     || ((eventBit = eventMask & AWTEvent.WINDOW_EVENT_MASK) != 0 &&
         (event.id >= WindowEvent.WINDOW_FIRST &&
         event.id <= WindowEvent.WINDOW_LAST))
     || ((eventBit = eventMask & AWTEvent.ACTION_EVENT_MASK) != 0 &&
         event.id >= ActionEvent.ACTION_FIRST &&
         event.id <= ActionEvent.ACTION_LAST)
     || ((eventBit = eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0 &&
         event.id >= AdjustmentEvent.ADJUSTMENT_FIRST &&
         event.id <= AdjustmentEvent.ADJUSTMENT_LAST)
     || ((eventBit = eventMask & AWTEvent.ITEM_EVENT_MASK) != 0 &&
         event.id >= ItemEvent.ITEM_FIRST &&
         event.id <= ItemEvent.ITEM_LAST)
     || ((eventBit = eventMask & AWTEvent.TEXT_EVENT_MASK) != 0 &&
         event.id >= TextEvent.TEXT_FIRST &&
         event.id <= TextEvent.TEXT_LAST)
     || ((eventBit = eventMask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0 &&
         event.id >= InputMethodEvent.INPUT_METHOD_FIRST &&
         event.id <= InputMethodEvent.INPUT_METHOD_LAST)
     || ((eventBit = eventMask & AWTEvent.PAINT_EVENT_MASK) != 0 &&
         event.id >= PaintEvent.PAINT_FIRST &&
         event.id <= PaintEvent.PAINT_LAST)
     || ((eventBit = eventMask & AWTEvent.INVOCATION_EVENT_MASK) != 0 &&
         event.id >= InvocationEvent.INVOCATION_FIRST &&
         event.id <= InvocationEvent.INVOCATION_LAST)
     || ((eventBit = eventMask & AWTEvent.HIERARCHY_EVENT_MASK) != 0 &&
         event.id == HierarchyEvent.HIERARCHY_CHANGED)
     || ((eventBit = eventMask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0 &&
         (event.id == HierarchyEvent.ANCESTOR_MOVED ||
          event.id == HierarchyEvent.ANCESTOR_RESIZED))
     || ((eventBit = eventMask & AWTEvent.WINDOW_STATE_EVENT_MASK) != 0 &&
         event.id == WindowEvent.WINDOW_STATE_CHANGED)
     || ((eventBit = eventMask & AWTEvent.WINDOW_FOCUS_EVENT_MASK) != 0 &&
         (event.id == WindowEvent.WINDOW_GAINED_FOCUS ||
          event.id == WindowEvent.WINDOW_LOST_FOCUS))
        || ((eventBit = eventMask & sun.awt.SunToolkit.GRAB_EVENT_MASK) != 0 &&
            (event instanceof sun.awt.UngrabEvent))) {
        // Get the index of the call count for this event type.
        // Instead of using Math.log(...) we will calculate it with
        // bit shifts. That's what previous implementation looked like:
        //
        // int ci = (int) (Math.log(eventBit)/Math.log(2));
        int ci = 0;
        for (long eMask = eventBit; eMask != 0; eMask >>>= 1, ci++) {
        }
        ci--;
        // Call the listener as many times as it was added for this
        // event type.
        for (int i=0; i<calls[ci]; i++) {
            listener.eventDispatched(event);
        }
    }
}
 
源代码10 项目: openjdk-jdk9   文件: EventDispatchThread.java
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;
}
 
源代码11 项目: jdk8u-jdk   文件: EventDispatchThread.java
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;
}
 
源代码12 项目: Java8CN   文件: EventDispatchThread.java
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;
}
 
源代码13 项目: hottub   文件: EventDispatchThread.java
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;
}
 
源代码14 项目: openjdk-8-source   文件: EventDispatchThread.java
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;
}
 
源代码15 项目: openjdk-8   文件: EventDispatchThread.java
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;
}
 
源代码16 项目: jdk8u_jdk   文件: EventDispatchThread.java
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;
}
 
源代码17 项目: jdk8u-jdk   文件: EventDispatchThread.java
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;
}
 
源代码18 项目: jdk-1.7-annotated   文件: EventDispatchThread.java
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;
}
 
源代码19 项目: jdk8u-dev-jdk   文件: EventDispatchThread.java
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;
}