jdk/src/share/classes/sun/swing/JLightweightFrame.java
changeset 20127 a3a34675d847
parent 19026 96141cb8d7eb
child 20136 594c0830f18c
equal deleted inserted replaced
20126:e09648d4170c 20127:a3a34675d847
    31 import java.awt.Container;
    31 import java.awt.Container;
    32 import java.awt.Dimension;
    32 import java.awt.Dimension;
    33 import java.awt.EventQueue;
    33 import java.awt.EventQueue;
    34 import java.awt.Graphics;
    34 import java.awt.Graphics;
    35 import java.awt.Graphics2D;
    35 import java.awt.Graphics2D;
       
    36 import java.awt.MouseInfo;
       
    37 import java.awt.Point;
    36 import java.awt.Rectangle;
    38 import java.awt.Rectangle;
    37 import java.awt.event.ComponentListener;
       
    38 import java.awt.event.ContainerEvent;
    39 import java.awt.event.ContainerEvent;
    39 import java.awt.event.ContainerListener;
    40 import java.awt.event.ContainerListener;
    40 import java.awt.image.BufferedImage;
    41 import java.awt.image.BufferedImage;
    41 import java.awt.image.DataBufferInt;
    42 import java.awt.image.DataBufferInt;
    42 import java.beans.PropertyChangeEvent;
    43 import java.beans.PropertyChangeEvent;
    46 import javax.swing.JLayeredPane;
    47 import javax.swing.JLayeredPane;
    47 import javax.swing.JPanel;
    48 import javax.swing.JPanel;
    48 import javax.swing.JRootPane;
    49 import javax.swing.JRootPane;
    49 import javax.swing.LayoutFocusTraversalPolicy;
    50 import javax.swing.LayoutFocusTraversalPolicy;
    50 import javax.swing.RootPaneContainer;
    51 import javax.swing.RootPaneContainer;
       
    52 import javax.swing.SwingUtilities;
    51 
    53 
    52 import sun.awt.LightweightFrame;
    54 import sun.awt.LightweightFrame;
    53 import sun.security.action.GetPropertyAction;
    55 import sun.security.action.GetPropertyAction;
    54 
    56 
    55 /**
    57 /**
    85      */
    87      */
    86     private boolean copyBufferEnabled;
    88     private boolean copyBufferEnabled;
    87     private int[] copyBuffer;
    89     private int[] copyBuffer;
    88 
    90 
    89     private PropertyChangeListener layoutSizeListener;
    91     private PropertyChangeListener layoutSizeListener;
       
    92 
       
    93     static {
       
    94         SwingAccessor.setJLightweightFrameAccessor(new SwingAccessor.JLightweightFrameAccessor() {
       
    95             @Override
       
    96             public void updateCursor(JLightweightFrame frame) {
       
    97                 frame.updateClientCursor();
       
    98             }
       
    99         });
       
   100     }
    90 
   101 
    91     /**
   102     /**
    92      * Constructs a new, initially invisible {@code JLightweightFrame}
   103      * Constructs a new, initially invisible {@code JLightweightFrame}
    93      * instance.
   104      * instance.
    94      */
   105      */
   356 
   367 
   357     @Override
   368     @Override
   358     public Component getGlassPane() {
   369     public Component getGlassPane() {
   359         return getRootPane().getGlassPane();
   370         return getRootPane().getGlassPane();
   360     }
   371     }
       
   372 
       
   373 
       
   374     /*
       
   375      * Notifies client toolkit that it should change a cursor.
       
   376      *
       
   377      * Called from the peer via SwingAccessor, because the
       
   378      * Component.updateCursorImmediately method is final
       
   379      * and could not be overridden.
       
   380      */
       
   381     private void updateClientCursor() {
       
   382         Point p = MouseInfo.getPointerInfo().getLocation();
       
   383         SwingUtilities.convertPointFromScreen(p, this);
       
   384         Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
       
   385         if (target != null) {
       
   386             content.setCursor(target.getCursor());
       
   387         }
       
   388     }
   361 }
   389 }