6786238: api/javax_swing/DefaultDesktopManager/descriptions.html#xxxFrame Fails with NPE since 6u12 b02
authoralexp
Tue, 25 May 2010 20:22:44 +0400
changeset 5587 72871be64138
parent 5586 5bcd7734900b
child 5588 57eca0aa621e
6786238: api/javax_swing/DefaultDesktopManager/descriptions.html#xxxFrame Fails with NPE since 6u12 b02 Reviewed-by: rupashka
jdk/src/share/classes/javax/swing/DefaultDesktopManager.java
--- a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java	Fri May 21 17:49:15 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java	Tue May 25 20:22:44 2010 +0400
@@ -26,16 +26,12 @@
 
 package javax.swing;
 
+import com.sun.awt.AWTUtilities;
+import sun.awt.AWTAccessor;
+import sun.awt.SunToolkit;
+
 import java.awt.*;
 import java.beans.PropertyVetoException;
-import java.beans.PropertyChangeEvent;
-import javax.swing.border.Border;
-import java.awt.event.ComponentListener;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-
-import sun.awt.AWTAccessor;
-import sun.awt.SunToolkit;
 
 /** This is an implementation of the <code>DesktopManager</code>.
   * It currently implements the basic behaviors for managing
@@ -318,7 +314,10 @@
         dragMode = DEFAULT_DRAG_MODE;
         if (p != null) {
             String mode = (String)p.getClientProperty("JDesktopPane.dragMode");
-            if (mode != null && mode.equals("outline")) {
+            Window window = SwingUtilities.getWindowAncestor(f);
+            if (window != null && !AWTUtilities.isWindowOpaque(window)) {
+                dragMode = DEFAULT_DRAG_MODE;
+            } else if (mode != null && mode.equals("outline")) {
                 dragMode = OUTLINE_DRAG_MODE;
             } else if (mode != null && mode.equals("faster")
                     && f instanceof JInternalFrame