< prev index next >

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

Print this page




5005          * all KeyEventPostProcessors
5006          * (see DefaultKeyboardFocusManager.dispatchKeyEvent())
5007          */
5008         if (!(e instanceof KeyEvent)) {
5009             ComponentPeer tpeer = peer;
5010             if (e instanceof FocusEvent && (tpeer == null || tpeer instanceof LightweightPeer)) {
5011                 // if focus owner is lightweight then its native container
5012                 // processes event
5013                 Component source = (Component)e.getSource();
5014                 if (source != null) {
5015                     Container target = source.getNativeContainer();
5016                     if (target != null) {
5017                         tpeer = target.peer;
5018                     }
5019                 }
5020             }
5021             if (tpeer != null) {
5022                 tpeer.handleEvent(e);
5023             }
5024         }






5025     } // dispatchEventImpl()
5026 
5027     /*
5028      * If newEventsOnly is false, method is called so that ScrollPane can
5029      * override it and handle common-case mouse wheel scrolling.  NOP
5030      * for Component.
5031      */
5032     void autoProcessMouseWheel(MouseWheelEvent e) {}
5033 
5034     /*
5035      * Dispatch given MouseWheelEvent to the first ancestor for which
5036      * MouseWheelEvents are enabled.
5037      *
5038      * Returns whether or not event was dispatched to an ancestor
5039      */
5040     @SuppressWarnings("deprecation")
5041     boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) {
5042         int newX, newY;
5043         newX = e.getX() + getX(); // Coordinates take into account at least
5044         newY = e.getY() + getY(); // the cursor's position relative to this




5005          * all KeyEventPostProcessors
5006          * (see DefaultKeyboardFocusManager.dispatchKeyEvent())
5007          */
5008         if (!(e instanceof KeyEvent)) {
5009             ComponentPeer tpeer = peer;
5010             if (e instanceof FocusEvent && (tpeer == null || tpeer instanceof LightweightPeer)) {
5011                 // if focus owner is lightweight then its native container
5012                 // processes event
5013                 Component source = (Component)e.getSource();
5014                 if (source != null) {
5015                     Container target = source.getNativeContainer();
5016                     if (target != null) {
5017                         tpeer = target.peer;
5018                     }
5019                 }
5020             }
5021             if (tpeer != null) {
5022                 tpeer.handleEvent(e);
5023             }
5024         }
5025 
5026         if (SunToolkit.isTouchKeyboardAutoShowEnabled() &&
5027             (toolkit instanceof SunToolkit) &&
5028             ((e instanceof MouseEvent) || (e instanceof FocusEvent))) {
5029             ((SunToolkit)toolkit).showOrHideTouchKeyboard(this, e);
5030         }
5031     } // dispatchEventImpl()
5032 
5033     /*
5034      * If newEventsOnly is false, method is called so that ScrollPane can
5035      * override it and handle common-case mouse wheel scrolling.  NOP
5036      * for Component.
5037      */
5038     void autoProcessMouseWheel(MouseWheelEvent e) {}
5039 
5040     /*
5041      * Dispatch given MouseWheelEvent to the first ancestor for which
5042      * MouseWheelEvents are enabled.
5043      *
5044      * Returns whether or not event was dispatched to an ancestor
5045      */
5046     @SuppressWarnings("deprecation")
5047     boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) {
5048         int newX, newY;
5049         newX = e.getX() + getX(); // Coordinates take into account at least
5050         newY = e.getY() + getY(); // the cursor's position relative to this


< prev index next >