Merge
authorlana
Sat, 23 Feb 2013 19:49:17 -0800
changeset 15984 b9b67f6eeb86
parent 15983 26a673dec5b2 (diff)
parent 15771 afa7c9d26291 (current diff)
child 15985 b9e25a486549
Merge
langtools/test/tools/javac/lambda/TargetType20.out
langtools/test/tools/javac/lambda/TargetType50.out
--- a/jdk/make/sun/lwawt/FILES_export_macosx.gmk	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/make/sun/lwawt/FILES_export_macosx.gmk	Sat Feb 23 19:49:17 2013 -0800
@@ -122,7 +122,6 @@
         sun/lwawt/macosx/CTextPipe.java \
         sun/lwawt/macosx/CDesktopPeer.java \
         sun/java2d/CRenderer.java \
-        sun/lwawt/macosx/EventDispatchAccess.java \
         sun/lwawt/macosx/NSPrintInfo.java \
         sun/lwawt/macosx/CAccessibility.java \
         sun/lwawt/macosx/CAccessible.java \
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Sat Feb 23 19:49:17 2013 -0800
@@ -439,7 +439,7 @@
     }
 
     @Override
-    public final Graphics getGraphics() {
+    public Graphics getGraphics() {
         final Graphics g = getOnscreenGraphics();
         if (g != null) {
             synchronized (getPeerTreeLock()){
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.lwawt;
+
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Window;
+import java.awt.dnd.DropTarget;
+
+import sun.awt.CausedFocusEvent;
+import sun.awt.LightweightFrame;
+
+public class LWLightweightFramePeer extends LWWindowPeer {
+
+    public LWLightweightFramePeer(LightweightFrame target,
+                                  PlatformComponent platformComponent,
+                                  PlatformWindow platformWindow)
+    {
+        super(target, platformComponent, platformWindow, LWWindowPeer.PeerType.LW_FRAME);
+    }
+
+    private LightweightFrame getLwTarget() {
+        return (LightweightFrame)getTarget();
+    }
+
+    @Override
+    public Graphics getGraphics() {
+        return getLwTarget().getGraphics();
+    }
+
+    @Override
+    protected void setVisibleImpl(final boolean visible) {
+    }
+
+    @Override
+    public boolean requestWindowFocus(CausedFocusEvent.Cause cause) {
+        if (!focusAllowedFor()) {
+            return false;
+        }
+        if (getPlatformWindow().rejectFocusRequest(cause)) {
+            return false;
+        }
+
+        Window opposite = LWKeyboardFocusManagerPeer.getInstance().
+            getCurrentFocusedWindow();
+
+        changeFocusedWindow(true, opposite);
+
+        return true;
+    }
+
+    @Override
+    public Point getLocationOnScreen() {
+        Rectangle bounds = getBounds();
+        return new Point(bounds.x, bounds.y); // todo
+    }
+
+    @Override
+    public Insets getInsets() {
+        return new Insets(0, 0, 0, 0);
+    }
+
+    @Override
+    public void setBounds(int x, int y, int w, int h, int op) {
+        setBounds(x, y, w, h, op, true, false);
+    }
+
+    @Override
+    public void updateCursorImmediately() {
+        // TODO: tries to switch to the awt/fx toolkit thread and causes a deadlock on macosx
+    }
+
+    @Override
+    public void addDropTarget(DropTarget dt) {
+    }
+
+    @Override
+    public void removeDropTarget(DropTarget dt) {
+    }
+
+    @Override
+    public void grab() {
+        getLwTarget().grabFocus();
+    }
+
+    @Override
+    public void ungrab() {
+        getLwTarget().ungrabFocus();
+    }
+}
--- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Sat Feb 23 19:49:17 2013 -0800
@@ -218,6 +218,23 @@
         return peer;
     }
 
+    private LWLightweightFramePeer createDelegatedLwPeer(LightweightFrame target,
+                                                         PlatformComponent platformComponent,
+                                                         PlatformWindow platformWindow)
+    {
+        LWLightweightFramePeer peer = new LWLightweightFramePeer(target, platformComponent, platformWindow);
+        targetCreatedPeer(target, peer);
+        peer.initialize();
+        return peer;
+    }
+
+    @Override
+    public FramePeer createLightweightFrame(LightweightFrame target) {
+        PlatformComponent platformComponent = createLwPlatformComponent();
+        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.LW_FRAME);
+        return createDelegatedLwPeer(target, platformComponent, platformWindow);
+    }
+
     @Override
     public WindowPeer createWindow(Window target) {
         PlatformComponent platformComponent = createPlatformComponent();
@@ -502,6 +519,8 @@
 
     protected abstract PlatformComponent createPlatformComponent();
 
+    protected abstract PlatformComponent createLwPlatformComponent();
+
     protected abstract FileDialogPeer createFileDialogPeer(FileDialog target);
 
     // ---- UTILITY METHODS ---- //
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Sat Feb 23 19:49:17 2013 -0800
@@ -48,7 +48,8 @@
         FRAME,
         DIALOG,
         EMBEDDED_FRAME,
-        VIEW_EMBEDDED_FRAME
+        VIEW_EMBEDDED_FRAME,
+        LW_FRAME
     }
 
     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer");
@@ -1090,7 +1091,7 @@
         return platformWindow.requestWindowFocus();
     }
 
-    private boolean focusAllowedFor() {
+    protected boolean focusAllowedFor() {
         Window window = getTarget();
         // TODO: check if modal blocked
         return window.isVisible() && window.isEnabled() && isFocusableWindow();
@@ -1113,10 +1114,15 @@
         return !(window instanceof Dialog || window instanceof Frame);
     }
 
+    @Override
+    public void emulateActivation(boolean activate) {
+        changeFocusedWindow(activate, null);
+    }
+
     /*
      * Changes focused window on java level.
      */
-    private void changeFocusedWindow(boolean becomesFocused, Window opposite) {
+    protected void changeFocusedWindow(boolean becomesFocused, Window opposite) {
         if (focusLog.isLoggable(PlatformLogger.FINE)) {
             focusLog.fine((becomesFocused?"gaining":"loosing") + " focus window: " + this);
         }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformComponent.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformComponent.java	Sat Feb 23 19:49:17 2013 -0800
@@ -35,7 +35,7 @@
  * On OSX {@code CPlatformComponent} stores pointer to the native CAlayer which
  * can be used from JAWT.
  */
-final class CPlatformComponent extends CFRetainedResource
+class CPlatformComponent extends CFRetainedResource
         implements PlatformComponent {
 
     private volatile PlatformWindow platformWindow;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWComponent.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package sun.lwawt.macosx;
+
+import sun.lwawt.PlatformWindow;
+
+class CPlatformLWComponent extends CPlatformComponent {
+
+    CPlatformLWComponent() {
+        super();
+    }
+
+    @Override
+    public long getPointer() {
+        return 0;
+    }
+
+    @Override
+    public void initialize(final PlatformWindow platformWindow) {
+    }
+
+    @Override
+    public void setBounds(final int x, final int y, final int w, final int h) {
+    }
+
+    @Override
+    public void dispose() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.lwawt.macosx;
+
+import sun.lwawt.LWWindowPeer;
+import sun.java2d.SurfaceData;
+
+public class CPlatformLWView extends CPlatformView {
+
+    public CPlatformLWView() {
+        super();
+    }
+
+    @Override
+    public void initialize(LWWindowPeer peer, CPlatformResponder responder) {
+        initializeBase(peer, responder);
+    }
+
+    @Override
+    public long getAWTView() {
+        return 0;
+    }
+
+    @Override
+    public boolean isOpaque() {
+        return true;
+    }
+
+    @Override
+    public void setBounds(int x, int y, int width, int height) {
+    }
+
+    @Override
+    public void enterFullScreenMode() {
+    }
+
+    @Override
+    public void exitFullScreenMode() {
+    }
+
+    @Override
+    public SurfaceData replaceSurfaceData() {
+        return null;
+    }
+
+    @Override
+    public SurfaceData getSurfaceData() {
+        return null;
+    }
+
+    @Override
+    public void dispose() {
+    }
+
+    @Override
+    public long getWindowLayerPtr() {
+        return 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.lwawt.macosx;
+
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.GraphicsDevice;
+import java.awt.Insets;
+import java.awt.MenuBar;
+import java.awt.Point;
+import java.awt.Window;
+import sun.awt.CausedFocusEvent;
+import sun.java2d.SurfaceData;
+import sun.lwawt.LWWindowPeer;
+import sun.lwawt.PlatformWindow;
+
+public class CPlatformLWWindow extends CPlatformWindow {
+
+    @Override
+    public void initialize(Window target, LWWindowPeer peer, PlatformWindow owner) {
+        initializeBase(target, peer, owner, new CPlatformLWView());
+    }
+
+    @Override
+    public void toggleFullScreen() {
+    }
+
+    @Override
+    public void setMenuBar(MenuBar mb) {
+    }
+
+    @Override
+    public void dispose() {
+    }
+
+    @Override
+    public FontMetrics getFontMetrics(Font f) {
+        return null;
+    }
+
+    @Override
+    public Insets getInsets() {
+        return new Insets(0, 0, 0, 0);
+    }
+
+    @Override
+    public Point getLocationOnScreen() {
+        return null;
+    }
+
+    @Override
+    public GraphicsDevice getGraphicsDevice() {
+        return null;
+    }
+
+    @Override
+    public SurfaceData getScreenSurface() {
+        return null;
+    }
+
+    @Override
+    public SurfaceData replaceSurfaceData() {
+        return null;
+    }
+
+    @Override
+    public void setBounds(int x, int y, int w, int h) {
+        if (getPeer() != null) {
+            getPeer().notifyReshape(x, y, w, h);
+        }
+    }
+
+    @Override
+    public void setVisible(boolean visible) {
+    }
+
+    @Override
+    public void setTitle(String title) {
+    }
+
+    @Override
+    public void updateIconImages() {
+    }
+
+    @Override
+    public long getNSWindowPtr() {
+        return 0;
+    }
+
+    @Override
+    public SurfaceData getSurfaceData() {
+        return null;
+    }
+
+    @Override
+    public void toBack() {
+    }
+
+    @Override
+    public void toFront() {
+    }
+
+    @Override
+    public void setResizable(final boolean resizable) {
+    }
+
+    @Override
+    public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {
+    }
+
+    @Override
+    public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) {
+        return false;
+    }
+
+    @Override
+    public boolean requestWindowFocus() {
+        return true;
+    }
+
+    @Override
+    public boolean isActive() {
+        return true;
+    }
+
+    @Override
+    public void updateFocusableWindowState() {
+    }
+
+    @Override
+    public Graphics transformGraphics(Graphics g) {
+        return null;
+    }
+
+    @Override
+    public void setAlwaysOnTop(boolean isAlwaysOnTop) {
+    }
+
+    @Override
+    public PlatformWindow getTopmostPlatformWindowUnderMouse(){
+        return null;
+    }
+
+    @Override
+    public void setOpacity(float opacity) {
+    }
+
+    @Override
+    public void setOpaque(boolean isOpaque) {
+    }
+
+    @Override
+    public void enterFullScreenMode() {
+    }
+
+    @Override
+    public void exitFullScreenMode() {
+    }
+
+    @Override
+    public void setWindowState(int windowState) {
+    }
+
+    @Override
+    public LWWindowPeer getPeer() {
+        return super.getPeer();
+    }
+
+    @Override
+    public CPlatformView getContentView() {
+        return super.getContentView();
+    }
+
+    @Override
+    public long getLayerPtr() {
+        return 0;
+    }
+}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Sat Feb 23 19:49:17 2013 -0800
@@ -54,8 +54,7 @@
     }
 
     public void initialize(LWWindowPeer peer, CPlatformResponder responder) {
-        this.peer = peer;
-        this.responder = responder;
+        initializeBase(peer, responder);
 
         if (!LWCToolkit.getSunAwtDisableCALayers()) {
             this.windowLayer = new CGLLayer(peer);
@@ -63,6 +62,11 @@
         setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
     }
 
+    protected void initializeBase(LWWindowPeer peer, CPlatformResponder responder) {
+        this.peer = peer;
+        this.responder = responder;
+    }
+
     public long getAWTView() {
         return ptr;
         }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Sat Feb 23 19:49:17 2013 -0800
@@ -44,7 +44,7 @@
 import com.apple.laf.ClientPropertyApplicator.Property;
 import com.sun.awt.AWTUtilities;
 
-public final class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
+public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
     private native long nativeCreateNSWindow(long nsViewPtr, long styleBits, double x, double y, double w, double h);
     private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
     private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
@@ -218,11 +218,7 @@
      */
     @Override // PlatformWindow
     public void initialize(Window _target, LWWindowPeer _peer, PlatformWindow _owner) {
-        this.peer = _peer;
-        this.target = _target;
-        if (_owner instanceof CPlatformWindow) {
-            this.owner = (CPlatformWindow)_owner;
-        }
+        initializeBase(_target, _peer, _owner, new CPlatformView());
 
         final int styleBits = getInitialStyleBits();
 
@@ -231,7 +227,6 @@
         String warningString = target.getWarningString();
 
         responder = new CPlatformResponder(peer, false);
-        contentView = new CPlatformView();
         contentView.initialize(peer, responder);
 
         final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0);
@@ -253,6 +248,15 @@
         validateSurface();
     }
 
+    protected void initializeBase(Window target, LWWindowPeer peer, PlatformWindow owner, CPlatformView view) {
+        this.peer = peer;
+        this.target = target;
+        if (owner instanceof CPlatformWindow) {
+            this.owner = (CPlatformWindow)owner;
+        }
+        this.contentView = view;
+    }
+
     private int getInitialStyleBits() {
         // defaults style bits
         int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE;
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Sat Feb 23 19:49:17 2013 -0800
@@ -160,6 +160,8 @@
             return new CPlatformEmbeddedFrame();
         } else if (peerType == PeerType.VIEW_EMBEDDED_FRAME) {
             return new CViewPlatformEmbeddedFrame();
+        } else if (peerType == PeerType.LW_FRAME) {
+            return new CPlatformLWWindow();
         } else {
             assert (peerType == PeerType.SIMPLEWINDOW || peerType == PeerType.DIALOG || peerType == PeerType.FRAME);
             return new CPlatformWindow();
@@ -172,6 +174,11 @@
     }
 
     @Override
+    protected PlatformComponent createLwPlatformComponent() {
+        return new CPlatformLWComponent();
+    }
+
+    @Override
     protected FileDialogPeer createFileDialogPeer(FileDialog target) {
         return new CFileDialog(target);
     }
--- a/jdk/src/share/classes/java/awt/peer/FramePeer.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/share/classes/java/awt/peer/FramePeer.java	Sat Feb 23 19:49:17 2013 -0800
@@ -125,4 +125,10 @@
     // into an EmbeddedFramePeer which would extend FramePeer
     Rectangle getBoundsPrivate();
 
+    /**
+     * Requests the peer to emulate window activation.
+     *
+     * @param activate activate or deactivate the window
+     */
+    void emulateActivation(boolean activate);
 }
--- a/jdk/src/share/classes/java/awt/peer/WindowPeer.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/share/classes/java/awt/peer/WindowPeer.java	Sat Feb 23 19:49:17 2013 -0800
@@ -27,8 +27,6 @@
 
 import java.awt.*;
 
-import java.awt.image.BufferedImage;
-
 /**
  * The peer interface for {@link Window}.
  *
--- a/jdk/src/share/classes/javax/swing/JFrame.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/JFrame.java	Sat Feb 23 19:49:17 2013 -0800
@@ -387,13 +387,14 @@
             operation != EXIT_ON_CLOSE) {
             throw new IllegalArgumentException("defaultCloseOperation must be one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, DISPOSE_ON_CLOSE, or EXIT_ON_CLOSE");
         }
+
+        if (operation == EXIT_ON_CLOSE) {
+            SecurityManager security = System.getSecurityManager();
+            if (security != null) {
+                security.checkExit(0);
+            }
+        }
         if (this.defaultCloseOperation != operation) {
-            if (operation == EXIT_ON_CLOSE) {
-                SecurityManager security = System.getSecurityManager();
-                if (security != null) {
-                    security.checkExit(0);
-                }
-            }
             int oldValue = this.defaultCloseOperation;
             this.defaultCloseOperation = operation;
             firePropertyChange("defaultCloseOperation", oldValue, operation);
--- a/jdk/src/share/classes/javax/swing/text/html/FormView.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/share/classes/javax/swing/text/html/FormView.java	Sat Feb 23 19:49:17 2013 -0800
@@ -159,6 +159,10 @@
             attr.getAttribute(StyleConstants.NameAttribute);
         JComponent c = null;
         Object model = attr.getAttribute(StyleConstants.ModelAttribute);
+
+        // Remove listeners previously registered in shared model
+        // when a new UI component is replaced.  See bug 7189299.
+        removeStaleListenerForModel(model);
         if (t == HTML.Tag.INPUT) {
             c = createInputComponent(attr, model);
         } else if (t == HTML.Tag.SELECT) {
@@ -310,6 +314,63 @@
         return c;
     }
 
+    private void removeStaleListenerForModel(Object model) {
+        if (model instanceof DefaultButtonModel) {
+            // case of JButton whose model is DefaultButtonModel
+            // Need to remove stale ActionListener, ChangeListener and
+            // ItemListener that are instance of AbstractButton$Handler.
+            DefaultButtonModel buttonModel = (DefaultButtonModel) model;
+            String listenerClass = "javax.swing.AbstractButton$Handler";
+            for (ActionListener listener : buttonModel.getActionListeners()) {
+                if (listenerClass.equals(listener.getClass().getName())) {
+                    buttonModel.removeActionListener(listener);
+                }
+            }
+            for (ChangeListener listener : buttonModel.getChangeListeners()) {
+                if (listenerClass.equals(listener.getClass().getName())) {
+                    buttonModel.removeChangeListener(listener);
+                }
+            }
+            for (ItemListener listener : buttonModel.getItemListeners()) {
+                if (listenerClass.equals(listener.getClass().getName())) {
+                    buttonModel.removeItemListener(listener);
+                }
+            }
+        } else if (model instanceof AbstractListModel) {
+            // case of JComboBox and JList
+            // For JList, the stale ListDataListener is instance
+            // BasicListUI$Handler.
+            // For JComboBox, there are 2 stale ListDataListeners, which are
+            // BasicListUI$Handler and BasicComboBoxUI$Handler.
+            AbstractListModel listModel = (AbstractListModel) model;
+            String listenerClass1 =
+                    "javax.swing.plaf.basic.BasicListUI$Handler";
+            String listenerClass2 =
+                    "javax.swing.plaf.basic.BasicComboBoxUI$Handler";
+            for (ListDataListener listener : listModel.getListDataListeners()) {
+                if (listenerClass1.equals(listener.getClass().getName())
+                        || listenerClass2.equals(listener.getClass().getName()))
+                {
+                    listModel.removeListDataListener(listener);
+                }
+            }
+        } else if (model instanceof AbstractDocument) {
+            // case of JPasswordField, JTextField and JTextArea
+            // All have 2 stale DocumentListeners.
+            String listenerClass1 =
+                    "javax.swing.plaf.basic.BasicTextUI$UpdateHandler";
+            String listenerClass2 =
+                    "javax.swing.text.DefaultCaret$Handler";
+            AbstractDocument docModel = (AbstractDocument) model;
+            for (DocumentListener listener : docModel.getDocumentListeners()) {
+                if (listenerClass1.equals(listener.getClass().getName())
+                        || listenerClass2.equals(listener.getClass().getName()))
+                {
+                    docModel.removeDocumentListener(listener);
+                }
+            }
+        }
+    }
 
     /**
      * Determines the maximum span for this view along an
@@ -347,7 +408,7 @@
 
 
     /**
-     * Responsible for processeing the ActionEvent.
+     * Responsible for processing the ActionEvent.
      * If the element associated with the FormView,
      * has a type of "submit", "reset", "text" or "password"
      * then the action is processed.  In the case of a "submit"
--- a/jdk/src/share/classes/sun/awt/EmbeddedFrame.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/share/classes/sun/awt/EmbeddedFrame.java	Sat Feb 23 19:49:17 2013 -0800
@@ -582,5 +582,8 @@
 
         public void repositionSecurityWarning() {
         }
-     }
+
+        public void emulateActivation(boolean activate) {
+        }
+    }
 } // class EmbeddedFrame
--- a/jdk/src/share/classes/sun/awt/HToolkit.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/share/classes/sun/awt/HToolkit.java	Sat Feb 23 19:49:17 2013 -0800
@@ -64,6 +64,11 @@
         throw new HeadlessException();
     }
 
+    public FramePeer createLightweightFrame(LightweightFrame target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
     public FramePeer createFrame(Frame target)
         throws HeadlessException {
         throw new HeadlessException();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/LightweightFrame.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.awt;
+
+import java.awt.Container;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.MenuBar;
+import java.awt.MenuComponent;
+import java.awt.Toolkit;
+import java.awt.peer.FramePeer;
+
+/**
+ * The class provides basic functionality for a lightweight frame
+ * implementation. A subclass is expected to provide painting to an
+ * offscreen image and access to it. Thus it can be used for lightweight
+ * embedding.
+ *
+ * @author Artem Ananiev
+ * @author Anton Tarasov
+ */
+@SuppressWarnings("serial")
+public abstract class LightweightFrame extends Frame {
+
+    /**
+     * Constructs a new, initially invisible {@code LightweightFrame}
+     * instance.
+     */
+    public LightweightFrame() {
+        setUndecorated(true);
+        setResizable(true);
+        setEnabled(true);
+    }
+
+    /**
+     * Blocks introspection of a parent window by this child.
+     *
+     * @return null
+     */
+    @Override public final Container getParent() { return null; }
+
+    @Override public Graphics getGraphics() { return null; }
+
+    @Override public final boolean isResizable() { return true; }
+
+    // Block modification of any frame attributes, since they aren't
+    // applicable for a lightweight frame.
+
+    @Override public final void setTitle(String title) {}
+    @Override public final void setIconImage(Image image) {}
+    @Override public final void setIconImages(java.util.List<? extends Image> icons) {}
+    @Override public final void setMenuBar(MenuBar mb) {}
+    @Override public final void setResizable(boolean resizable) {}
+    @Override public final void remove(MenuComponent m) {}
+    @Override public final void toFront() {}
+    @Override public final void toBack() {}
+
+    @Override public void addNotify() {
+        synchronized (getTreeLock()) {
+            if (getPeer() == null) {
+                SunToolkit stk = (SunToolkit)Toolkit.getDefaultToolkit();
+                try {
+                    setPeer(stk.createLightweightFrame(this));
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+            super.addNotify();
+        }
+    }
+
+    private void setPeer(final FramePeer p) {
+        AWTAccessor.getComponentAccessor().setPeer(this, p);
+    }
+
+    /**
+     * Requests the peer to emulate activation or deactivation of the
+     * frame. Peers should override this method if they are to implement
+     * this functionality.
+     *
+     * @param activate if <code>true</code>, activates the frame;
+     *                 otherwise, deactivates the frame
+     */
+    public void emulateActivation(boolean activate) {
+        ((FramePeer)getPeer()).emulateActivation(activate);
+    }
+
+    /**
+     * Delegates the focus grab action to the client (embedding) application.
+     * The method is called by the AWT grab machinery.
+     *
+     * @see SunToolkit#grab(java.awt.Window)
+     */
+    public abstract void grabFocus();
+
+    /**
+     * Delegates the focus ungrab action to the client (embedding) application.
+     * The method is called by the AWT grab machinery.
+     *
+     * @see SunToolkit#ungrab(java.awt.Window)
+     */
+    public abstract void ungrabFocus();
+}
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Sat Feb 23 19:49:17 2013 -0800
@@ -131,6 +131,9 @@
     public abstract FramePeer createFrame(Frame target)
         throws HeadlessException;
 
+    public abstract FramePeer createLightweightFrame(LightweightFrame target)
+        throws HeadlessException;
+
     public abstract DialogPeer createDialog(Dialog target)
         throws HeadlessException;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.EventQueue;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.image.BufferedImage;
+import java.awt.image.DataBufferInt;
+
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+import javax.swing.JRootPane;
+import javax.swing.LayoutFocusTraversalPolicy;
+import javax.swing.RootPaneContainer;
+
+import sun.awt.LightweightFrame;
+
+/**
+ * The frame serves as a lightweight container which paints its content
+ * to an offscreen image and provides access to the image's data via the
+ * {@link LightweightContent} interface. Note, that it may not be shown
+ * as a standalone toplevel frame. Its purpose is to provide functionality
+ * for lightweight embedding.
+ *
+ * @author Artem Ananiev
+ * @author Anton Tarasov
+ */
+public final class JLightweightFrame extends LightweightFrame implements RootPaneContainer {
+
+    private final JRootPane rootPane = new JRootPane();
+
+    private LightweightContent content;
+
+    private Component component;
+    private JPanel contentPane;
+
+    private BufferedImage bbImage;
+
+    /**
+     * Constructs a new, initially invisible {@code JLightweightFrame}
+     * instance.
+     */
+    public JLightweightFrame() {
+        super();
+        add(rootPane, BorderLayout.CENTER);
+        setBackground(new Color(0, 0, 0, 0));
+        setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
+    }
+
+    /**
+     * Sets the {@link LightweightContent} instance for this frame.
+     * The {@code JComponent} object returned by the
+     * {@link LightweightContent#getComponent()} method is immediately
+     * added to the frame's content pane.
+     *
+     * @param content the {@link LightweightContent} instance
+     */
+    public void setContent(LightweightContent content) {
+        this.content = content;
+        this.component = content.getComponent();
+
+        initInterior();
+    }
+
+    @Override
+    public Graphics getGraphics() {
+        if (bbImage == null) return null;
+
+        Graphics2D g = bbImage.createGraphics();
+        g.setBackground(getBackground());
+        g.setColor(getForeground());
+        g.setFont(getFont());
+        return g;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @see LightweightContent#focusGrabbed()
+     */
+    @Override
+    public void grabFocus() {
+        if (content != null) content.focusGrabbed();
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @see LightweightContent#focusUngrabbed()
+     */
+    @Override
+    public void ungrabFocus() {
+        if (content != null) content.focusUngrabbed();
+    }
+
+    private void initInterior() {
+        contentPane = new JPanel() {
+            @Override
+            public void paint(Graphics g) {
+                content.paintLock();
+                try {
+                    super.paint(g);
+
+                    final Rectangle clip = g.getClipBounds() != null ?
+                            g.getClipBounds() : new Rectangle(0, 0, contentPane.getWidth(), contentPane.getHeight());
+
+                    clip.x = Math.max(0, clip.x);
+                    clip.y = Math.max(0, clip.y);
+                    clip.width = Math.min(contentPane.getWidth(), clip.width);
+                    clip.height = Math.min(contentPane.getHeight(), clip.height);
+
+                    EventQueue.invokeLater(new Runnable() {
+                        @Override
+                        public void run() {
+                            content.imageUpdated(clip.x, clip.y, clip.width, clip.height);
+                        }
+                    });
+                } finally {
+                    content.paintUnlock();
+                }
+            }
+            @Override
+            protected boolean isPaintingOrigin() {
+                return true;
+            }
+        };
+        contentPane.setLayout(new BorderLayout());
+        contentPane.add(component);
+        setContentPane(contentPane);
+    }
+
+    @SuppressWarnings("deprecation")
+    @Override public void reshape(int x, int y, int width, int height) {
+        super.reshape(x, y, width, height);
+
+        if (width == 0 || height == 0) {
+            return;
+        }
+
+        content.paintLock();
+        try {
+            if ((bbImage == null) || (width != bbImage.getWidth()) || (height != bbImage.getHeight())) {
+                boolean createBB = true;
+                int newW = width;
+                int newH = height;
+                if (bbImage != null) {
+                    int oldW = bbImage.getWidth();
+                    int oldH = bbImage.getHeight();
+                    if ((oldW >= newW) && (oldH >= newH)) {
+                        createBB = false;
+                    } else {
+                        if (oldW >= newW) {
+                            newW = oldW;
+                        } else {
+                            newW = Math.max((int)(oldW * 1.2), width);
+                        }
+                        if (oldH >= newH) {
+                            newH = oldH;
+                        } else {
+                            newH = Math.max((int)(oldH * 1.2), height);
+                        }
+                    }
+                }
+                if (createBB) {
+                    BufferedImage oldBB = bbImage;
+                    bbImage = new BufferedImage(newW, newH, BufferedImage.TYPE_INT_ARGB_PRE);
+                    if (oldBB != null) {
+                        Graphics g = bbImage.getGraphics();
+                        try {
+                            g.drawImage(oldBB, 0, 0, newW, newH, null);
+                        } finally {
+                            g.dispose();
+                            oldBB.flush();
+                        }
+                    }
+                    DataBufferInt dataBuf = (DataBufferInt)bbImage.getRaster().getDataBuffer();
+                    content.imageBufferReset(dataBuf.getData(), 0, 0, width, height, bbImage.getWidth());
+                } else {
+                    content.imageReshaped(0, 0, width, height);
+                }
+            }
+        } finally {
+            content.paintUnlock();
+        }
+    }
+
+    @Override
+    public JRootPane getRootPane() {
+        return rootPane;
+    }
+
+    @Override
+    public void setContentPane(Container contentPane) {
+        getRootPane().setContentPane(contentPane);
+    }
+
+    @Override
+    public Container getContentPane() {
+        return getRootPane().getContentPane();
+    }
+
+    @Override
+    public void setLayeredPane(JLayeredPane layeredPane) {
+        getRootPane().setLayeredPane(layeredPane);
+    }
+
+    @Override
+    public JLayeredPane getLayeredPane() {
+        return getRootPane().getLayeredPane();
+    }
+
+    @Override
+    public void setGlassPane(Component glassPane) {
+        getRootPane().setGlassPane(glassPane);
+    }
+
+    @Override
+    public Component getGlassPane() {
+        return getRootPane().getGlassPane();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/swing/LightweightContent.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.swing;
+
+import javax.swing.JComponent;
+
+/**
+ * The interface by means of which the {@link JLightweightFrame} class
+ * communicates to its client application.
+ * <p>
+ * The client application implements this interface so it can response
+ * to requests and process notifications from {@code JLightweightFrame}.
+ * An implementation of this interface is associated with a {@code
+ * JLightweightFrame} instance via the {@link JLightweightFrame#setContent}
+ * method.
+ *
+ * A hierarchy of components contained in the {@code JComponent} instance
+ * returned by the {@link #getComponent} method should not contain any
+ * heavyweight components, otherwise {@code JLightweightFrame} may fail
+ * to paint it.
+ *
+ * @author Artem Ananiev
+ * @author Anton Tarasov
+ * @author Jim Graham
+ */
+public interface LightweightContent {
+
+    /**
+     * The client application overrides this method to return the {@code
+     * JComponent} instance which the {@code JLightweightFrame} container
+     * will paint as its lightweight content. A hierarchy of components
+     * contained in this component should not contain any heavyweight objects.
+     *
+     * @return the component to paint
+     */
+    public JComponent getComponent();
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that it acquires the paint lock. The client application
+     * should implement the locking mechanism in order to synchronize access
+     * to the content image data, shared between {@code JLightweightFrame}
+     * and the client application.
+     *
+     * @see #paintUnlock
+     */
+    public void paintLock();
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that it releases the paint lock. The client application
+     * should implement the locking mechanism in order to synchronize access
+     * to the content image data, shared between {@code JLightweightFrame}
+     * and the client application.
+     *
+     * @see #paintLock
+     */
+    public void paintUnlock();
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that a new data buffer has been set as a content pixel
+     * buffer. Typically this occurs when a buffer of a larger size is
+     * created in response to a content resize event. The method reports
+     * a reference to the pixel data buffer, the content image bounds
+     * within the buffer and the line stride of the buffer. These values
+     * have the following correlation.
+     * <p>
+     * The {@code width} and {@code height} matches the size of the content
+     * (the component returned from the {@link #getComponent} method). The
+     * {@code x} and {@code y} is the origin of the content, {@code (0, 0)}
+     * in the coordinate space of the content, appearing at
+     * {@code data[y * linestride + x]} in the buffer. All indices
+     * {@code data[(y + j) * linestride + (x + i)]} where
+     * {@code (0 <= i < width)} and {@code (0 <= j < height)} will represent
+     * valid pixel data, {@code (i, j)} in the coordinate space of the content.
+     *
+     * @param data the content pixel data buffer of INT_ARGB_PRE type
+     * @param x the x coordinate of the image
+     * @param y the y coordinate of the image
+     * @param width the width of the image
+     * @param height the height of the image
+     * @param linestride the line stride of the pixel buffer
+     */
+    public void imageBufferReset(int[] data,
+                                 int x, int y,
+                                 int width, int height,
+                                 int linestride);
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that the content image bounds have been changed within the
+     * image's pixel buffer.
+     *
+     * @param x the x coordinate of the image
+     * @param y the y coordinate of the image
+     * @param width the width of the image
+     * @param height the height of the image
+     *
+     * @see #imageBufferReset
+     */
+    public void imageReshaped(int x, int y, int width, int height);
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that a part of the content image, or the whole image has
+     * been updated. The method reports bounds of the rectangular dirty region.
+     * The {@code dirtyX} and {@code dirtyY} is the origin of the dirty
+     * rectangle, which is relative to the origin of the content, appearing
+     * at {@code data[(y + dirtyY] * linestride + (x + dirtyX)]} in the pixel
+     * buffer (see {@link #imageBufferReset}). All indices
+     * {@code data[(y + dirtyY + j) * linestride + (x + dirtyX + i)]} where
+     * {@code (0 <= i < dirtyWidth)} and {@code (0 <= j < dirtyHeight)}
+     * will represent valid pixel data, {@code (i, j)} in the coordinate space
+     * of the dirty rectangle.
+     *
+     * @param dirtyX the x coordinate of the dirty rectangle,
+     *        relative to the image origin
+     * @param dirtyY the y coordinate of the dirty rectangle,
+     *        relative to the image origin
+     * @param dirtyWidth the width of the dirty rectangle
+     * @param dirtyHeight the height of the dirty rectangle
+     *
+     * @see #imageBufferReset
+     * @see #imageReshaped
+     */
+    public void imageUpdated(int dirtyX, int dirtyY,
+                             int dirtyWidth, int dirtyHeight);
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that the frame has grabbed focus.
+     */
+    public void focusGrabbed();
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that the frame has ungrabbed focus.
+     */
+    public void focusUngrabbed();
+}
--- a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java	Sat Feb 23 19:49:17 2013 -0800
@@ -641,4 +641,6 @@
     public Rectangle getBoundsPrivate() {
         return getBounds();
     }
+
+    public void emulateActivation(boolean doActivate) {}
 }
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Sat Feb 23 19:49:17 2013 -0800
@@ -419,6 +419,10 @@
         return peer;
     }
 
+    public FramePeer createLightweightFrame(LightweightFrame target) {
+        return null;
+    }
+
     public FramePeer createFrame(Frame target) {
         FramePeer peer = new XFramePeer(target);
         targetCreatedPeer(target, peer);
--- a/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Sat Feb 23 19:49:17 2013 -0800
@@ -226,15 +226,15 @@
     }
 
     @SuppressWarnings("deprecation")
-    public void synthesizeWindowActivation(final boolean doActivate) {
-        if (!doActivate || EventQueue.isDispatchThread()) {
-            ((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(doActivate);
+    public void synthesizeWindowActivation(final boolean activate) {
+        if (!activate || EventQueue.isDispatchThread()) {
+            ((WFramePeer)getPeer()).emulateActivation(activate);
         } else {
             // To avoid focus concurrence b/w IE and EmbeddedFrame
             // activation is postponed by means of posting it to EDT.
             EventQueue.invokeLater(new Runnable() {
                     public void run() {
-                        ((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(true);
+                        ((WFramePeer)getPeer()).emulateActivation(true);
                     }
                 });
         }
--- a/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Sat Feb 23 19:49:17 2013 -0800
@@ -65,8 +65,6 @@
 
     public native Rectangle getBoundsPrivate();
 
-    public native void synthesizeWmActivate(boolean doActivate);
-
     @Override
     public boolean isAccelCapable() {
         // REMIND: Temp workaround for issues with using HW acceleration
--- a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java	Sat Feb 23 19:49:17 2013 -0800
@@ -200,4 +200,11 @@
     public Rectangle getBoundsPrivate() {
         return getBounds();
     }
+
+    // TODO: implement it in peers. WLightweightFramePeer may implement lw version.
+    public void emulateActivation(boolean activate) {
+        synthesizeWmActivate(activate);
+    }
+
+    private native void synthesizeWmActivate(boolean activate);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.awt.windows;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.event.ComponentEvent;
+import java.awt.event.MouseEvent;
+
+import sun.awt.LightweightFrame;
+
+public class WLightweightFramePeer extends WFramePeer {
+
+    public WLightweightFramePeer(LightweightFrame target) {
+        super(target);
+    }
+
+    private LightweightFrame getLwTarget() {
+        return (LightweightFrame)target;
+    }
+
+    @Override
+    public Graphics getGraphics() {
+        return getLwTarget().getGraphics();
+    }
+
+    @Override
+    public void show() {
+        super.show();
+        postEvent(new ComponentEvent((Component)getTarget(), ComponentEvent.COMPONENT_SHOWN));
+    }
+
+    @Override
+    public void hide() {
+        super.hide();
+        postEvent(new ComponentEvent((Component)getTarget(), ComponentEvent.COMPONENT_HIDDEN));
+    }
+
+    @Override
+    public void reshape(int x, int y, int width, int height) {
+        super.reshape(x, y, width, height);
+        postEvent(new ComponentEvent((Component) getTarget(), ComponentEvent.COMPONENT_MOVED));
+        postEvent(new ComponentEvent((Component) getTarget(), ComponentEvent.COMPONENT_RESIZED));
+    }
+
+    @Override
+    public void handleEvent(java.awt.AWTEvent e) {
+        if (e.getID() == MouseEvent.MOUSE_PRESSED) {
+            emulateActivation(true);
+        }
+        super.handleEvent(e);
+    }
+
+    @Override
+    public void grab() {
+        getLwTarget().grabFocus();
+    }
+
+    @Override
+    public void ungrab() {
+        getLwTarget().ungrabFocus();
+    }
+}
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Sat Feb 23 19:49:17 2013 -0800
@@ -37,6 +37,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import sun.awt.AWTAutoShutdown;
+import sun.awt.LightweightFrame;
 import sun.awt.SunToolkit;
 import sun.awt.Win32GraphicsDevice;
 import sun.awt.Win32GraphicsEnvironment;
@@ -398,6 +399,12 @@
         return peer;
     }
 
+    public FramePeer createLightweightFrame(LightweightFrame target) {
+        FramePeer peer = new WLightweightFramePeer(target);
+        targetCreatedPeer(target, peer);
+        return peer;
+    }
+
     public CanvasPeer createCanvas(Canvas target) {
         CanvasPeer peer = new WCanvasPeer(target);
         targetCreatedPeer(target, peer);
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp	Sat Feb 23 19:49:17 2013 -0800
@@ -105,6 +105,7 @@
     m_parentWnd = NULL;
     menuBar = NULL;
     m_isEmbedded = FALSE;
+    m_isLightweight = FALSE;
     m_ignoreWmSize = FALSE;
     m_isMenuDropped = FALSE;
     m_isInputMethodWindow = FALSE;
@@ -170,14 +171,13 @@
              * area of the browser is a Java Frame for parenting purposes, but
              * really a Windows child window
              */
+            BOOL isEmbeddedInstance = FALSE;
+            BOOL isEmbedded = FALSE;
             cls = env->FindClass("sun/awt/EmbeddedFrame");
-            if (cls == NULL) {
-                return NULL;
+            if (cls) {
+                isEmbeddedInstance = env->IsInstanceOf(target, cls);
             }
             INT_PTR handle;
-            jboolean isEmbeddedInstance = env->IsInstanceOf(target, cls);
-            jboolean isEmbedded = FALSE;
-
             if (isEmbeddedInstance) {
                 handle = static_cast<INT_PTR>(env->GetLongField(target, AwtFrame::handleID));
                 if (handle != 0) {
@@ -186,6 +186,13 @@
             }
             frame->m_isEmbedded = isEmbedded;
 
+            BOOL isLightweight = FALSE;
+            cls = env->FindClass("sun/awt/LightweightFrame");
+            if (cls) {
+                isLightweight = env->IsInstanceOf(target, cls);
+            }
+            frame->m_isLightweight = isLightweight;
+
             if (isEmbedded) {
                 hwndParent = (HWND)handle;
                 RECT rect;
@@ -230,6 +237,23 @@
                                  rect.bottom-rect.top);
                 frame->InitPeerGraphicsConfig(env, self);
                 AwtToolkit::GetInstance().RegisterEmbedderProcessId(hwndParent);
+            } else if (isLightweight) {
+                frame->m_isUndecorated = true;
+                frame->m_peerObject = env->NewGlobalRef(self);
+                frame->RegisterClass();
+
+                DWORD exStyle = 0;
+                DWORD style = WS_POPUP;
+
+                frame->CreateHWnd(env, L"",
+                                  style,
+                                  exStyle,
+                                  0, 0, 0, 0,
+                                  0,
+                                  NULL,
+                                  ::GetSysColor(COLOR_WINDOWTEXT),
+                                  ::GetSysColor(COLOR_WINDOWFRAME),
+                                  self);
             } else {
                 jint state = env->CallIntMethod(self, AwtFrame::getExtendedStateMID);
                 DWORD exStyle;
@@ -345,16 +369,20 @@
         case WM_SETFOCUS:
             if (sm_inSynthesizeFocus) break; // pass it up the WindowProc chain
 
-            if (!sm_suppressFocusAndActivation && IsEmbeddedFrame()) {
-                AwtSetActiveWindow();
+            if (!sm_suppressFocusAndActivation) {
+                if (IsLightweightFrame() || IsEmbeddedFrame()) {
+                    AwtSetActiveWindow();
+                }
             }
             mr = mrConsume;
             break;
         case WM_KILLFOCUS:
             if (sm_inSynthesizeFocus) break; // pass it up the WindowProc chain
 
-            if (!sm_suppressFocusAndActivation && IsEmbeddedFrame()) {
-                AwtWindow::SynthesizeWmActivate(FALSE, GetHWnd(), NULL);
+            if (!sm_suppressFocusAndActivation) {
+                if (IsLightweightFrame() || IsEmbeddedFrame()) {
+                    AwtWindow::SynthesizeWmActivate(FALSE, GetHWnd(), NULL);
+                }
 
             } else if (sm_restoreFocusAndActivation) {
                 if (AwtComponent::GetFocusedWindow() != NULL) {
@@ -640,6 +668,10 @@
     HWND hwnd = GetHWnd();
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 
+    if (IsLightweightFrame()) {
+        return;
+    }
+
     DTRACE_PRINTLN3("AwtFrame::Show:%s%s%s",
                   m_iconic ? " iconic" : "",
                   m_zoomed ? " zoomed" : "",
@@ -992,6 +1024,9 @@
         // b) focus is requested to some of the frame's child.
         m_actualFocusedWindow = NULL;
     }
+    if (IsLightweightFrame()) {
+        return TRUE;
+    }
     return AwtWindow::AwtSetActiveWindow(isMouseEventCause);
 }
 
@@ -1873,7 +1908,7 @@
 }
 
 JNIEXPORT void JNICALL
-Java_sun_awt_windows_WEmbeddedFramePeer_synthesizeWmActivate(JNIEnv *env, jobject self, jboolean doActivate)
+Java_sun_awt_windows_WFramePeer_synthesizeWmActivate(JNIEnv *env, jobject self, jboolean doActivate)
 {
     TRY;
 
--- a/jdk/src/windows/native/sun/windows/awt_Frame.h	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.h	Sat Feb 23 19:49:17 2013 -0800
@@ -72,6 +72,8 @@
 
     /* Returns whether this frame is embedded in an external native frame. */
     INLINE BOOL IsEmbeddedFrame() { return m_isEmbedded; }
+    /* Returns whether this frame is lightweight. */
+    INLINE virtual BOOL IsLightweightFrame() { return m_isLightweight; }
 
     INLINE BOOL IsSimpleWindow() { return FALSE; }
 
@@ -169,6 +171,9 @@
     /* The frame is an EmbeddedFrame. */
     BOOL m_isEmbedded;
 
+    /* The frame is a LightweightFrame */
+    BOOL m_isLightweight;
+
     /* used so that calls to ::MoveWindow in SetMenuBar don't propogate
        because they are immediately followed by calls to Component.resize */
     BOOL m_ignoreWmSize;
--- a/jdk/src/windows/native/sun/windows/awt_Window.h	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/src/windows/native/sun/windows/awt_Window.h	Sat Feb 23 19:49:17 2013 -0800
@@ -143,6 +143,7 @@
     INLINE HICON GetHIcon() {return m_hIcon;};
     INLINE HICON GetHIconSm() {return m_hIconSm;};
     INLINE BOOL IsIconInherited() {return m_iconInherited;};
+    INLINE virtual BOOL IsLightweightFrame() {return FALSE;}
 
     /* Post events to the EventQueue */
     void SendComponentEvent(jint eventId);
@@ -193,8 +194,10 @@
 
     // Execute on Toolkit only.
     INLINE static LRESULT SynthesizeWmActivate(BOOL doActivate, HWND targetHWnd, HWND oppositeHWnd) {
+        AwtWindow *win = static_cast<AwtWindow*>(AwtComponent::GetComponent(targetHWnd));
         if (doActivate &&
-            (!::IsWindowVisible(targetHWnd) || ::IsIconic(::GetAncestor(targetHWnd, GA_ROOT))))
+            (!::IsWindowVisible(targetHWnd) || ::IsIconic(::GetAncestor(targetHWnd, GA_ROOT))) &&
+            (win == NULL || !win->IsLightweightFrame()))
         {
             // The activation is rejected if either:
             // - The toplevel is not visible
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/MouseDraggedOutCauseScrollingTest/MouseDraggedOutCauseScrollingTest.html	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,43 @@
+<html>
+<!--
+  Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+  This code is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License version 2 only, as
+  published by the Free Software Foundation.
+
+  This code is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  version 2 for more details (a copy is included in the LICENSE file that
+  accompanied this code).
+
+  You should have received a copy of the GNU General Public License version
+  2 along with this work; if not, write to the Free Software Foundation,
+  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+  or visit www.oracle.com if you need additional information or have any
+  questions.
+  -->
+
+<!--  
+  @test
+  @bug 6243382 8006070
+  @summary Dragging of mouse outside of a List and Choice area don't work properly on XAWT
+  @author Dmitry.Cherepanov@SUN.COM area=awt.list
+  @run applet/manual=yesno MouseDraggedOutCauseScrollingTest.html
+  -->
+<head>
+<title> ManualYesNoTest </title>
+</head>
+<body>
+
+<h1>ManualYesNoTest<br>Bug ID: </h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="MouseDraggedOutCauseScrollingTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/MouseDraggedOutCauseScrollingTest/MouseDraggedOutCauseScrollingTest.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug 6243382 8006070
+  @summary Dragging of mouse outside of a List and Choice area don't work properly on XAWT
+  @author Dmitry.Cherepanov@SUN.COM area=awt.list
+  @run applet/manual=yesno MouseDraggedOutCauseScrollingTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+
+public class MouseDraggedOutCauseScrollingTest extends Applet
+{
+    Choice choice;
+    List singleList;
+    List multipleList;
+
+    public void init()
+    {
+        this.setLayout (new GridLayout (1, 3));
+
+        choice = new Choice();
+        singleList = new List(3, false);
+        multipleList = new List(3, true);
+
+        choice.add("Choice");
+        for (int i = 1; i < 100; i++){
+            choice.add(""+i);
+        }
+
+        singleList.add("Single list");
+        for (int i = 1; i < 100; i++)
+            singleList.add(""+i);
+
+        multipleList.add("Multiple list");
+        for (int i = 1; i < 100; i++)
+            multipleList.add(""+i);
+
+        this.add(choice);
+        this.add(singleList);
+        this.add(multipleList);
+
+        String toolkitName = Toolkit.getDefaultToolkit().getClass().getName();
+        if (!toolkitName.equals("sun.awt.X11.XToolkit")) {
+            String[] instructions =
+            {
+                "This test is not applicable to the current platform. Press PASS"
+            };
+            Sysout.createDialogWithInstructions( instructions );
+        } else {
+            String[] instructions =
+            {
+                "0) Please note, that this is only Motif/XAWT test. At first, make the applet active",
+                "1.1) Click on the choice",
+                "1.2) Press the left button of the mouse and keep on any item of the choice, for example 5",
+                "1.3) Drag mouse out of the area of the unfurled list, at the same time hold the X coordinate of the mouse position about the same",
+                "1.4) To make sure, that when the Y coordinate of the mouse position higher of the upper bound of the list then scrolling UP of the list and selected item changes on the upper. If not, the test failed",
+                "1.5) To make sure, that when the Y coordinate of the mouse position under of the lower bound of the list then scrolling DOWN of the list and selected item changes on the lower. If not, the test failed",
+                "-----------------------------------",
+                "2.1) Click on the single list",
+                "2.2) Press the left button of the mouse and keep on any item of the list, for example 5",
+                "2.3) Drag mouse out of the area of the unfurled list, at the same time hold the X coordinate of the mouse position about the same",
+                "2.4) To make sure, that when the Y coordinate of the mouse position higher of the upper bound of the list then scrolling UP of the list and selected item changes on the upper. If not, the test failed",
+                "2.5) To make sure, that when the Y coordinate of the mouse position under of the lower bound of the list then scrolling DOWN of the list and selected item changes on the lower. If not, the test failed",
+                "-----------------------------------",
+                "3.1) Click on the multiple list",
+                "3.2) Press the left button of the mouse and keep on any item of the list, for example 5",
+                "3.3) Drag mouse out of the area of the unfurled list, at the same time hold the X coordinate of the mouse position about the same",
+                "3.4) To make sure, that when the Y coordinate of the mouse position higher of the upper bound of the list then scrolling of the list NO OCCURED and selected item NO CHANGES on the upper. If not, the test failed",
+                "3.5) To make sure, that when the Y coordinate of the mouse position under of the lower bound of the list then scrolling of the list NO OCCURED and selected item NO CHANGES on the lower. If not, the test failed",
+                "4) Test passed."
+            };
+            Sysout.createDialogWithInstructions( instructions );
+        }
+
+    }//End  init()
+
+    public void start ()
+    {
+        setSize (400,100);
+        setVisible(true);
+        validate();
+
+    }// start()
+
+}// class ManualYesNoTest
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalDialogMultiscreenTest/ModalDialogMultiscreenTest.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,441 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 6430802 8008379
+  @summary WM should not hang after show()/close()
+  @author anthony.petrov@sun.com: area=awt.modal
+  @run main/manual ModalDialogMultiscreenTest
+*/
+
+
+/**
+ * ModalDialogMultiscreenTest.java
+ *
+ * summary: Tests whether a WM will hang on show()/close() a modal dialog in multiscreen mode
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+
+public class ModalDialogMultiscreenTest
+{
+
+    private static class ButtonActionListener implements ActionListener {
+        JFrame frame;
+        JDialog dialog;
+        public ButtonActionListener(JFrame frame, JDialog dialog) {
+            this.frame = frame;
+            this.dialog = dialog;
+        }
+        public void actionPerformed(ActionEvent e) {
+            dialog.setLocationRelativeTo(frame);
+            dialog.setVisible(true);
+        }
+    }
+    public static class TestDialog extends JDialog {
+        public TestDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc) {
+            super(owner, title, modal, gc);
+            setSize(200, 100);
+            JButton button = new JButton("Close");
+            button.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    dispose();
+                }
+            });
+            getContentPane().add(button);
+        }
+    }
+
+    private static void init()
+    {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gs = ge.getScreenDevices();
+
+        Sysout.createDialog( );
+
+        if (gs.length < 2) {
+            System.out.println("Not multi-head environment, test not valid!");
+            ModalDialogMultiscreenTest.pass( );
+        }
+
+        String[] instructions =
+        {
+            "The test should be run on a multi-head X (non-xinerama) systems.",
+            "Otherwise click the Pass button right now.",
+            "You will see an open Frame on each screen your system has.",
+            "The frame has an 'Open dialog' button.",
+            "Clicking the button opens a modal dialog with a Close button.",
+            "The test procedure:",
+            "1. Open a dialog and close it with appropriate buttons.",
+            "2. Switch to another screen ($ DISPLAY=X.Y xprop)",
+            "3. Repeat steps 1-2 several times (about 3*<number-of-screens>)",
+            "If the test doesn't cause the window manager to hang, it's passed."
+        };
+        Sysout.printInstructions( instructions );
+
+
+        for (int i = 0; i < gs.length; i++) {
+            JFrame frame = new JFrame("Frame "+i,gs[i].getDefaultConfiguration());
+            JButton button = new JButton("Open Dialog");
+            button.setMinimumSize(new Dimension(200, 100));
+            button.setPreferredSize(new Dimension(200, 100));
+            button.setSize(new Dimension(200, 100));
+            button.addActionListener(new ButtonActionListener(frame, new TestDialog(frame, "Dialog #"+i, true, gs[i].getDefaultConfiguration())));
+            frame.getContentPane().add(button);
+            frame.pack();
+            frame.setVisible(true);
+        }
+
+    }//End  init()
+
+
+    //ap203012: NO MORE CHANGES BELOW THIS LINE
+
+
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-defined
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test passed nor test failed has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try
+        {
+            Thread.sleep( sleepTime );
+            //Timed out, so fail the test
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            if( ! testGeneratedInterrupt ) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        Sysout.println( "The test passed." );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //first check if this is executing in main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        //pass was called from a different thread, so set the flag and interrupt
+        // the main thead.
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail()
+    {
+        //test writer didn't specify why test failed, so give generic
+        fail( "it just plain failed! :-)" );
+    }
+
+    public static synchronized void fail( String whyFailed )
+    {
+        Sysout.println( "The test failed: " + whyFailed );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //check if this called from main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+
+}// class ModalDialogMultiscreenTest
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+
+//************ Begin classes defined for the test ****************
+
+// make listeners in a class defined here, and instantiate them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+ {
+   static int newVar = 0;
+
+   public void eventDispatched(AWTEvent e)
+    {
+      //Counting events to see if we get enough
+      eventCount++;
+
+      if( eventCount == 20 )
+       {
+         //got enough events, so pass
+
+         ModalDialogMultiscreenTest.pass();
+       }
+      else if( tries == 20 )
+       {
+         //tried too many times without getting enough events so fail
+
+         ModalDialogMultiscreenTest.fail();
+       }
+
+    }// eventDispatched()
+
+ }// NewClass class
+
+*/
+
+
+//************** End classes defined for the test *******************
+
+
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog implements ActionListener
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+    Panel  buttonP = new Panel();
+    Button passB = new Button( "pass" );
+    Button failB = new Button( "fail" );
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        passB = new Button( "pass" );
+        passB.setActionCommand( "pass" );
+        passB.addActionListener( this );
+        buttonP.add( "East", passB );
+
+        failB = new Button( "fail" );
+        failB.setActionCommand( "fail" );
+        failB.addActionListener( this );
+        buttonP.add( "West", failB );
+
+        add( "South", buttonP );
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+    //catch presses of the passed and failed buttons.
+    //simply call the standard pass() or fail() static methods of
+    //ModalDialogMultiscreenTest
+    public void actionPerformed( ActionEvent e )
+    {
+        if( e.getActionCommand() == "pass" )
+        {
+            ModalDialogMultiscreenTest.pass();
+        }
+        else
+        {
+            ModalDialogMultiscreenTest.fail();
+        }
+    }
+
+}// TestDialog  class
--- a/jdk/test/java/awt/Modal/WsDisabledStyle/Winkey/Winkey.java	Thu Feb 21 11:13:23 2013 -0800
+++ b/jdk/test/java/awt/Modal/WsDisabledStyle/Winkey/Winkey.java	Sat Feb 23 19:49:17 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,8 @@
  */
 
 /*
-  @test %I% %E%
-  @bug 6572263 6571808
+  @test
+  @bug 6572263 6571808 8005920
   @summary  PIT:FileDialog minimized to taskbar(through 'Show Desktop')selecting the fileDialog using windowList
   @author dmitry.cherepanov: area=awt.modal
   @run main/manual Winkey
@@ -48,12 +48,14 @@
 
         String[] instructions =
         {
+            " 0. This test is for MS Windows only, if you use other OS, press \"pass\" button.",
             " 1. there is a frame with a 'show modal' button, ",
             " 2. press the button to show a modal dialog, ",
             " 3. the modal dialog will be shown over the frame, ",
             " 4. please verify that all (5.1, 5.2.1, 5.2.2) the following tests pass: ",
             " ",
             " 5.1. press combination Windows Key and M key to minimize all windows, ",
+            "      note that the modal dialog and modal blocked windows are NOT minimized",
             " 5.2. press combination Windows Key and D key to show desktop, ",
             "      5.2.1. restore the dialog by choosing this one in the ALT-TAB list, ",
             "      5.2.2. restore the dialog by mouse click on taskbar (on java or any other item)",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/7189299/bug7189299.java	Sat Feb 23 19:49:17 2013 -0800
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Portions Copyright (c) 2013 IBM Corporation
+ */
+import java.awt.BorderLayout;
+import java.awt.Toolkit;
+
+import java.awt.event.ActionListener;
+import javax.swing.DefaultButtonModel;
+import javax.swing.JEditorPane;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.StyleContext;
+import javax.swing.text.html.HTMLEditorKit;
+import sun.awt.SunToolkit;
+
+
+/*
+ * @test
+ * @bug 8008289
+ * @summary Shared ButtonModel instance should deregister previous listeners.
+ * @author Frank Ding
+ */
+public class bug7189299 {
+
+    private static JEditorPane html;
+    private static JFrame frame;
+
+    private static void setup() {
+        /**
+         * Note the input type is not restricted to "submit". Types "image",
+         * "checkbox", "radio" have the same problem.
+         */
+        html = new JEditorPane("text/html",
+                "<html><body><form action=\"http://localhost.cgi\">"
+                        + "<input type=submit name=submit value=\"submit\"/>"
+                        + "</form></body></html>");
+        frame = new JFrame();
+        frame.setLayout(new BorderLayout());
+        frame.add(html, BorderLayout.CENTER);
+        frame.setSize(200, 100);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setVisible(true);
+    }
+
+    private static void doTest() {
+        /*
+         * Calling updateComponentTreeUI creates a new FormView instance with
+         * its own associated JButton instance. The same DefaultButtonModel
+         * instance is used for both FormView's.
+         *
+         * The action listeners associated with (the JButton for) the first
+         * FormView should be unregistered from this common DefaultButtonModel,
+         * such that only those for the new FormView remain.
+         */
+        SwingUtilities.updateComponentTreeUI(html);
+    }
+
+    private static void verifySingleDefaultButtonModelListener() {
+        HTMLEditorKit htmlEditorKit = (HTMLEditorKit) html.getEditorKit();
+        StyleContext.NamedStyle style = ((StyleContext.NamedStyle) htmlEditorKit
+                .getInputAttributes());
+        DefaultButtonModel model = ((DefaultButtonModel) style
+                .getAttribute(StyleConstants.ModelAttribute));
+        ActionListener[] listeners = model.getActionListeners();
+        int actionListenerNum = listeners.length;
+        if (actionListenerNum != 1) {
+            throw new RuntimeException(
+                    "Expected single ActionListener object registered with "
+                    + "DefaultButtonModel; found " + actionListenerNum
+                    + " listeners registered.");
+        }
+
+        int changeListenerNum = model.getChangeListeners().length;
+        if (changeListenerNum != 1) {
+            throw new RuntimeException(
+                    "Expected at most one ChangeListener object registered "
+                    + "with DefaultButtonModel; found " + changeListenerNum
+                    + " listeners registered.");
+        }
+        int itemListenerNum = model.getItemListeners().length;
+        if (itemListenerNum != 1) {
+            throw new RuntimeException(
+                    "Expected at most one ItemListener object registered "
+                    + "with DefaultButtonModel; found " + itemListenerNum
+                    + " listeners registered.");
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        final SunToolkit toolkit = ((SunToolkit) Toolkit.getDefaultToolkit());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                setup();
+            }
+        });
+        toolkit.realSync();
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                try {
+                    verifySingleDefaultButtonModelListener();
+                    doTest();
+                    verifySingleDefaultButtonModelListener();
+                } finally {
+                    frame.dispose();
+                }
+            }
+        });
+    }
+}