< prev index next >

src/share/classes/java/awt/Component.java

Print this page




4948          * all KeyEventPostProcessors
4949          * (see DefaultKeyboardFocusManager.dispatchKeyEvent())
4950          */
4951         if (!(e instanceof KeyEvent)) {
4952             ComponentPeer tpeer = peer;
4953             if (e instanceof FocusEvent && (tpeer == null || tpeer instanceof LightweightPeer)) {
4954                 // if focus owner is lightweight then its native container
4955                 // processes event
4956                 Component source = (Component)e.getSource();
4957                 if (source != null) {
4958                     Container target = source.getNativeContainer();
4959                     if (target != null) {
4960                         tpeer = target.getPeer();
4961                     }
4962                 }
4963             }
4964             if (tpeer != null) {
4965                 tpeer.handleEvent(e);
4966             }
4967         }






4968     } // dispatchEventImpl()
4969 
4970     /*
4971      * If newEventsOnly is false, method is called so that ScrollPane can
4972      * override it and handle common-case mouse wheel scrolling.  NOP
4973      * for Component.
4974      */
4975     void autoProcessMouseWheel(MouseWheelEvent e) {}
4976 
4977     /*
4978      * Dispatch given MouseWheelEvent to the first ancestor for which
4979      * MouseWheelEvents are enabled.
4980      *
4981      * Returns whether or not event was dispatched to an ancestor
4982      */
4983     boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) {
4984         int newX, newY;
4985         newX = e.getX() + getX(); // Coordinates take into account at least
4986         newY = e.getY() + getY(); // the cursor's position relative to this
4987                                   // Component (e.getX()), and this Component's




4948          * all KeyEventPostProcessors
4949          * (see DefaultKeyboardFocusManager.dispatchKeyEvent())
4950          */
4951         if (!(e instanceof KeyEvent)) {
4952             ComponentPeer tpeer = peer;
4953             if (e instanceof FocusEvent && (tpeer == null || tpeer instanceof LightweightPeer)) {
4954                 // if focus owner is lightweight then its native container
4955                 // processes event
4956                 Component source = (Component)e.getSource();
4957                 if (source != null) {
4958                     Container target = source.getNativeContainer();
4959                     if (target != null) {
4960                         tpeer = target.getPeer();
4961                     }
4962                 }
4963             }
4964             if (tpeer != null) {
4965                 tpeer.handleEvent(e);
4966             }
4967         }
4968 
4969         if (SunToolkit.isTouchKeyboardAutoShowEnabled() &&
4970             (toolkit instanceof SunToolkit) &&
4971             ((e instanceof MouseEvent) || (e instanceof FocusEvent))) {
4972             ((SunToolkit)toolkit).showOrHideTouchKeyboard(this, e);
4973         }
4974     } // dispatchEventImpl()
4975 
4976     /*
4977      * If newEventsOnly is false, method is called so that ScrollPane can
4978      * override it and handle common-case mouse wheel scrolling.  NOP
4979      * for Component.
4980      */
4981     void autoProcessMouseWheel(MouseWheelEvent e) {}
4982 
4983     /*
4984      * Dispatch given MouseWheelEvent to the first ancestor for which
4985      * MouseWheelEvents are enabled.
4986      *
4987      * Returns whether or not event was dispatched to an ancestor
4988      */
4989     boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) {
4990         int newX, newY;
4991         newX = e.getX() + getX(); // Coordinates take into account at least
4992         newY = e.getY() + getY(); // the cursor's position relative to this
4993                                   // Component (e.getX()), and this Component's


< prev index next >