--- old/src/java.desktop/share/classes/java/awt/Component.java 2015-05-07 01:43:12.000000000 +0300 +++ new/src/java.desktop/share/classes/java/awt/Component.java 2015-05-07 01:43:12.000000000 +0300 @@ -1312,6 +1312,24 @@ } /** + * Determines the bounds which will be displayed on the screen. + * + * @return the visible part of bounds in the coordinate space of this comp + */ + private Rectangle getRecursivelyVisibleBounds() { + final Component container = getContainer(); + final Rectangle bounds = getBounds(); + if (container == null) { + // we are top level window or haven't a container, return our bounds + return bounds; + } + // translate the container's bounds to our coordinate space + final Rectangle parentsBounds = container.getRecursivelyVisibleBounds(); + parentsBounds.setLocation(0, 0); + return parentsBounds.intersection(bounds); + } + + /** * Translates absolute coordinates into coordinates in the coordinate * space of this component. */ @@ -1487,7 +1505,7 @@ ComponentPeer peer = this.peer; if (peer != null) { peer.setEnabled(true); - if (visible) { + if (visible && !getRecursivelyVisibleBounds().isEmpty()) { updateCursorImmediately(); } } @@ -1541,7 +1559,7 @@ ComponentPeer peer = this.peer; if (peer != null) { peer.setEnabled(false); - if (visible) { + if (visible && !getRecursivelyVisibleBounds().isEmpty()) { updateCursorImmediately(); } }