< prev index next >
src/java.desktop/share/classes/java/awt/Component.java
Print this page
*** 1310,1319 ****
--- 1310,1338 ----
boolean isRecursivelyVisible() {
return visible && (parent == null || parent.isRecursivelyVisible());
}
/**
+ * Determines the bounds of a visible part of the component relative to its
+ * parents.
+ *
+ * @return the visible part of bounds
+ */
+ 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.
*/
Point pointRelativeToComponent(Point absolute) {
Point compCoords = getLocationOnScreen();
*** 1485,1495 ****
synchronized (getTreeLock()) {
enabled = true;
ComponentPeer peer = this.peer;
if (peer != null) {
peer.setEnabled(true);
! if (visible) {
updateCursorImmediately();
}
}
}
if (accessibleContext != null) {
--- 1504,1514 ----
synchronized (getTreeLock()) {
enabled = true;
ComponentPeer peer = this.peer;
if (peer != null) {
peer.setEnabled(true);
! if (visible && !getRecursivelyVisibleBounds().isEmpty()) {
updateCursorImmediately();
}
}
}
if (accessibleContext != null) {
*** 1539,1549 ****
transferFocus(false);
}
ComponentPeer peer = this.peer;
if (peer != null) {
peer.setEnabled(false);
! if (visible) {
updateCursorImmediately();
}
}
}
if (accessibleContext != null) {
--- 1558,1568 ----
transferFocus(false);
}
ComponentPeer peer = this.peer;
if (peer != null) {
peer.setEnabled(false);
! if (visible && !getRecursivelyVisibleBounds().isEmpty()) {
updateCursorImmediately();
}
}
}
if (accessibleContext != null) {
< prev index next >