6786238: api/javax_swing/DefaultDesktopManager/descriptions.html#xxxFrame Fails with NPE since 6u12 b02

Reviewed-by: rupashka
This commit is contained in:
Alexander Potochkin 2010-05-25 20:22:44 +04:00
parent f5b5248994
commit 9aca53da76

View File

@ -26,17 +26,13 @@
package javax.swing;
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 com.sun.awt.AWTUtilities;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
import java.awt.*;
import java.beans.PropertyVetoException;
/** This is an implementation of the <code>DesktopManager</code>.
* It currently implements the basic behaviors for managing
* <code>JInternalFrame</code>s in an arbitrary parent.
@ -318,7 +314,10 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
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