diff options
Diffstat (limited to 'libjava/classpath/java/awt/Component.java')
-rw-r--r-- | libjava/classpath/java/awt/Component.java | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/libjava/classpath/java/awt/Component.java b/libjava/classpath/java/awt/Component.java index ec03d631dcf..bd22ea3c984 100644 --- a/libjava/classpath/java/awt/Component.java +++ b/libjava/classpath/java/awt/Component.java @@ -1038,14 +1038,10 @@ public abstract class Component if ((c != null) && c.equals(background)) return; - // If c is null, inherit from closest ancestor whose bg is set. - if (c == null && parent != null) - c = parent.getBackground(); - if (peer != null && c != null) - peer.setBackground(c); - Color previous = background; background = c; + if (peer != null && c != null) + peer.setBackground(c); firePropertyChange("background", previous, c); } @@ -2642,7 +2638,7 @@ public abstract class Component { mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, listener); if (mouseMotionListener != null) - enableEvents(AWTEvent.MOUSE_EVENT_MASK); + enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); } /** @@ -2775,10 +2771,19 @@ public abstract class Component } /** - * Returns all registered EventListers of the given listenerType. + * Returns all registered {@link EventListener}s of the given + * <code>listenerType</code>. * - * @param listenerType the class of listeners to filter - * @return an array of registered listeners + * @param listenerType the class of listeners to filter (<code>null</code> + * not permitted). + * + * @return An array of registered listeners. + * + * @throws ClassCastException if <code>listenerType</code> does not implement + * the {@link EventListener} interface. + * @throws NullPointerException if <code>listenerType</code> is + * <code>null</code>. + * * @see #getComponentListeners() * @see #getFocusListeners() * @see #getHierarchyListeners() @@ -4786,7 +4791,12 @@ p * <li>the set of backward traversal keys void dispatchEventImpl(AWTEvent e) { Event oldEvent = translateEvent (e); - + // This boolean tells us not to process focus events when the focus + // opposite component is the same as the focus component. + boolean ignoreFocus = + (e instanceof FocusEvent && + ((FocusEvent)e).getComponent() == ((FocusEvent)e).getOppositeComponent()); + if (oldEvent != null) postEvent (oldEvent); @@ -4817,7 +4827,8 @@ p * <li>the set of backward traversal keys break; } } - if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE) + if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE + && !ignoreFocus) processEvent(e); } @@ -4853,11 +4864,12 @@ p * <li>the set of backward traversal keys case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: - case MouseEvent.MOUSE_MOVED: - case MouseEvent.MOUSE_DRAGGED: return (mouseListener != null - || mouseMotionListener != null || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0); + case MouseEvent.MOUSE_MOVED: + case MouseEvent.MOUSE_DRAGGED: + return (mouseMotionListener != null + || (eventMask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0); case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: |