src/share/classes/sun/swing/JLightweightFrame.java

Print this page




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.swing;
  27 
  28 import java.awt.BorderLayout;
  29 import java.awt.Color;
  30 import java.awt.Component;
  31 import java.awt.Container;
  32 import java.awt.Dimension;
  33 import java.awt.EventQueue;
  34 import java.awt.Graphics;
  35 import java.awt.Graphics2D;
  36 import java.awt.MouseInfo;
  37 import java.awt.Point;
  38 import java.awt.Rectangle;
  39 import java.awt.Window;







  40 import java.awt.event.ContainerEvent;
  41 import java.awt.event.ContainerListener;
  42 import java.awt.image.BufferedImage;
  43 import java.awt.image.DataBufferInt;
  44 import java.beans.PropertyChangeEvent;
  45 import java.beans.PropertyChangeListener;
  46 import java.security.AccessController;
  47 import javax.swing.JComponent;
  48 
  49 import javax.swing.JLayeredPane;
  50 import javax.swing.JPanel;
  51 import javax.swing.JRootPane;
  52 import javax.swing.LayoutFocusTraversalPolicy;
  53 import javax.swing.RepaintManager;
  54 import javax.swing.RootPaneContainer;
  55 import javax.swing.SwingUtilities;
  56 
  57 import sun.awt.DisplayChangedListener;
  58 import sun.awt.LightweightFrame;
  59 import sun.security.action.GetPropertyAction;


 454     @Override
 455     public Component getGlassPane() {
 456         return getRootPane().getGlassPane();
 457     }
 458 
 459 
 460     /*
 461      * Notifies client toolkit that it should change a cursor.
 462      *
 463      * Called from the peer via SwingAccessor, because the
 464      * Component.updateCursorImmediately method is final
 465      * and could not be overridden.
 466      */
 467     private void updateClientCursor() {
 468         Point p = MouseInfo.getPointerInfo().getLocation();
 469         SwingUtilities.convertPointFromScreen(p, this);
 470         Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
 471         if (target != null) {
 472             content.setCursor(target.getCursor());
 473         }























 474     }
 475 }


  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.swing;
  27 
  28 import java.awt.BorderLayout;
  29 import java.awt.Color;
  30 import java.awt.Component;
  31 import java.awt.Container;
  32 import java.awt.Dimension;
  33 import java.awt.EventQueue;
  34 import java.awt.Graphics;
  35 import java.awt.Graphics2D;
  36 import java.awt.MouseInfo;
  37 import java.awt.Point;
  38 import java.awt.Rectangle;
  39 import java.awt.Window;
  40 import java.awt.dnd.DragGestureEvent;
  41 import java.awt.dnd.DragGestureListener;
  42 import java.awt.dnd.DragGestureRecognizer;
  43 import java.awt.dnd.DragSource;
  44 import java.awt.dnd.DropTarget;
  45 import java.awt.dnd.InvalidDnDOperationException;
  46 import java.awt.dnd.peer.DragSourceContextPeer;
  47 import java.awt.event.ContainerEvent;
  48 import java.awt.event.ContainerListener;
  49 import java.awt.image.BufferedImage;
  50 import java.awt.image.DataBufferInt;
  51 import java.beans.PropertyChangeEvent;
  52 import java.beans.PropertyChangeListener;
  53 import java.security.AccessController;
  54 import javax.swing.JComponent;
  55 
  56 import javax.swing.JLayeredPane;
  57 import javax.swing.JPanel;
  58 import javax.swing.JRootPane;
  59 import javax.swing.LayoutFocusTraversalPolicy;
  60 import javax.swing.RepaintManager;
  61 import javax.swing.RootPaneContainer;
  62 import javax.swing.SwingUtilities;
  63 
  64 import sun.awt.DisplayChangedListener;
  65 import sun.awt.LightweightFrame;
  66 import sun.security.action.GetPropertyAction;


 461     @Override
 462     public Component getGlassPane() {
 463         return getRootPane().getGlassPane();
 464     }
 465 
 466 
 467     /*
 468      * Notifies client toolkit that it should change a cursor.
 469      *
 470      * Called from the peer via SwingAccessor, because the
 471      * Component.updateCursorImmediately method is final
 472      * and could not be overridden.
 473      */
 474     private void updateClientCursor() {
 475         Point p = MouseInfo.getPointerInfo().getLocation();
 476         SwingUtilities.convertPointFromScreen(p, this);
 477         Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
 478         if (target != null) {
 479             content.setCursor(target.getCursor());
 480         }
 481     }
 482 
 483     public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
 484             Class<T> abstractRecognizerClass,
 485             DragSource ds, Component c, int srcActions,
 486             DragGestureListener dgl)
 487     {
 488         return content == null ? null : content.createDragGestureRecognizer(
 489                 abstractRecognizerClass, ds, c, srcActions, dgl);
 490     }
 491 
 492     public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
 493         return content == null ? null : content.createDragSourceContextPeer(dge);
 494     }
 495 
 496     public void addDropTarget(DropTarget dt) {
 497         if (content == null) return;
 498         content.addDropTarget(dt);
 499     }
 500 
 501     public void removeDropTarget(DropTarget dt) {
 502         if (content == null) return;
 503         content.removeDropTarget(dt);
 504     }
 505 }