< prev index next >

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

Print this page




5019             }
5020             if (tpeer != null) {
5021                 tpeer.handleEvent(e);
5022             }
5023         }
5024     } // dispatchEventImpl()
5025 
5026     /*
5027      * If newEventsOnly is false, method is called so that ScrollPane can
5028      * override it and handle common-case mouse wheel scrolling.  NOP
5029      * for Component.
5030      */
5031     void autoProcessMouseWheel(MouseWheelEvent e) {}
5032 
5033     /*
5034      * Dispatch given MouseWheelEvent to the first ancestor for which
5035      * MouseWheelEvents are enabled.
5036      *
5037      * Returns whether or not event was dispatched to an ancestor
5038      */

5039     boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) {
5040         int newX, newY;
5041         newX = e.getX() + getX(); // Coordinates take into account at least
5042         newY = e.getY() + getY(); // the cursor's position relative to this
5043                                   // Component (e.getX()), and this Component's
5044                                   // position relative to its parent.
5045         MouseWheelEvent newMWE;
5046 
5047         if (eventLog.isLoggable(PlatformLogger.Level.FINEST)) {
5048             eventLog.finest("dispatchMouseWheelToAncestor");
5049             eventLog.finest("orig event src is of " + e.getSource().getClass());
5050         }
5051 
5052         /* parent field for Window refers to the owning Window.
5053          * MouseWheelEvents should NOT be propagated into owning Windows
5054          */
5055         synchronized (getTreeLock()) {
5056             Container anc = getParent();
5057             while (anc != null && !anc.eventEnabled(e)) {
5058                 // fix coordinates to be relative to new event source




5019             }
5020             if (tpeer != null) {
5021                 tpeer.handleEvent(e);
5022             }
5023         }
5024     } // dispatchEventImpl()
5025 
5026     /*
5027      * If newEventsOnly is false, method is called so that ScrollPane can
5028      * override it and handle common-case mouse wheel scrolling.  NOP
5029      * for Component.
5030      */
5031     void autoProcessMouseWheel(MouseWheelEvent e) {}
5032 
5033     /*
5034      * Dispatch given MouseWheelEvent to the first ancestor for which
5035      * MouseWheelEvents are enabled.
5036      *
5037      * Returns whether or not event was dispatched to an ancestor
5038      */
5039     @SuppressWarnings("deprecation")
5040     boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) {
5041         int newX, newY;
5042         newX = e.getX() + getX(); // Coordinates take into account at least
5043         newY = e.getY() + getY(); // the cursor's position relative to this
5044                                   // Component (e.getX()), and this Component's
5045                                   // position relative to its parent.
5046         MouseWheelEvent newMWE;
5047 
5048         if (eventLog.isLoggable(PlatformLogger.Level.FINEST)) {
5049             eventLog.finest("dispatchMouseWheelToAncestor");
5050             eventLog.finest("orig event src is of " + e.getSource().getClass());
5051         }
5052 
5053         /* parent field for Window refers to the owning Window.
5054          * MouseWheelEvents should NOT be propagated into owning Windows
5055          */
5056         synchronized (getTreeLock()) {
5057             Container anc = getParent();
5058             while (anc != null && !anc.eventEnabled(e)) {
5059                 // fix coordinates to be relative to new event source


< prev index next >