--- old/src/share/classes/sun/swing/JLightweightFrame.java 2013-09-12 15:59:48.000000000 +0400 +++ new/src/share/classes/sun/swing/JLightweightFrame.java 2013-09-12 15:59:47.000000000 +0400 @@ -33,8 +33,9 @@ import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.MouseInfo; +import java.awt.Point; import java.awt.Rectangle; -import java.awt.event.ComponentListener; import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.awt.image.BufferedImage; @@ -48,6 +49,7 @@ import javax.swing.JRootPane; import javax.swing.LayoutFocusTraversalPolicy; import javax.swing.RootPaneContainer; +import javax.swing.SwingUtilities; import sun.awt.LightweightFrame; import sun.security.action.GetPropertyAction; @@ -88,6 +90,15 @@ private PropertyChangeListener layoutSizeListener; + static { + SwingAccessor.setJLightweightFrameAccessor(new SwingAccessor.JLightweightFrameAccessor() { + @Override + public void updateCursor(JLightweightFrame frame) { + frame.updateClientCursor(); + } + }); + } + /** * Constructs a new, initially invisible {@code JLightweightFrame} * instance. @@ -358,4 +369,21 @@ public Component getGlassPane() { return getRootPane().getGlassPane(); } + + + /* + * Notifies client toolkit that it should change a cursor. + * + * Called from the peer via SwingAccessor, because the + * Component.updateCursorImmediately method is final + * and could not be overridden. + */ + private void updateClientCursor() { + Point p = MouseInfo.getPointerInfo().getLocation(); + SwingUtilities.convertPointFromScreen(p, this); + Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y); + if (target != null) { + content.setCursor(target.getCursor()); + } + } }