Merge
authorddehaven
Tue, 20 Jan 2015 11:23:03 -0800
changeset 28539 bb420dbad9d2
parent 28529 0388b3b63648 (current diff)
parent 28538 48d009ddfd46 (diff)
child 28540 04b399ec3dfc
child 29236 83273d785181
Merge
--- a/jdk/make/lib/Awt2dLibraries.gmk	Tue Jan 20 10:22:44 2015 -0800
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Tue Jan 20 11:23:03 2015 -0800
@@ -300,7 +300,6 @@
 
     LIBAWT_XAWT_DIRS := \
         $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt \
         $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
         $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility \
         $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsButtonUI.java	Tue Jan 20 10:22:44 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsButtonUI.java	Tue Jan 20 11:23:03 2015 -0800
@@ -248,7 +248,8 @@
 
         Part part = getXPButtonType(b);
 
-        if (b.isContentAreaFilled() && xp != null) {
+        if (b.isContentAreaFilled() && b.getBorder() != null
+                && b.isBorderPainted() && xp != null) {
 
             Skin skin = xp.getSkin(b, part);
 
--- a/jdk/src/java.desktop/share/classes/java/beans/package.html	Tue Jan 20 10:22:44 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/beans/package.html	Tue Jan 20 11:23:03 2015 -0800
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1998, 2014, 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
@@ -147,8 +147,8 @@
 
 For overview, architecture, and tutorial documentation, please see:
 <ul>
-  <li><a href="http://java.sun.com/docs/books/tutorial/javabeans/">JavaBeans</a>, a trail in <em>The Java Tutorial</em>.
-  <li><a href="http://java.sun.com/products/jfc/tsc/articles/persistence2/">Long-Term Persistence</a>, an article in <em>The Swing Connection</em>.
+  <li><a href="http://docs.oracle.com/javase/tutorial/javabeans/">JavaBeans</a>, a trail in <em>The Java Tutorial</em>.
+  <li><a href="http://www.oracle.com/technetwork/java/persistence2-141443.html">Long-Term Persistence</a>, an article in <em>The Swing Connection</em>.
 </ul>
 
 </body>
--- a/jdk/src/java.desktop/share/classes/javax/swing/ToolTipManager.java	Tue Jan 20 10:22:44 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/ToolTipManager.java	Tue Jan 20 11:23:03 2015 -0800
@@ -28,6 +28,7 @@
 
 import java.awt.event.*;
 import java.awt.*;
+import java.util.Objects;
 
 /**
  * Manages all the <code>ToolTips</code> in the system.
@@ -476,8 +477,8 @@
                             preferredLocation.equals(newPreferredLocation) :
                             (newPreferredLocation == null);
 
-                if (!sameComponent || !toolTipText.equals(newToolTipText) ||
-                         !sameLoc) {
+                if (!sameComponent || !Objects.equals(toolTipText, newToolTipText)
+                        || !sameLoc) {
                     toolTipText = newToolTipText;
                     preferredLocation = newPreferredLocation;
                     showTipWindow();
--- a/jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java	Tue Jan 20 10:22:44 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java	Tue Jan 20 11:23:03 2015 -0800
@@ -44,9 +44,7 @@
 import java.awt.Color;
 import java.awt.Insets;
 import java.awt.Dimension;
-import java.lang.reflect.Method;
 import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeEvent;
 import java.security.AccessController;
 import java.security.AccessControlContext;
 import java.security.PrivilegedAction;
@@ -76,7 +74,7 @@
 @SuppressWarnings("serial") // Same-version serialization only
 public class UIDefaults extends Hashtable<Object,Object>
 {
-    private static final Object PENDING = "Pending";
+    private static final Object PENDING = new Object();
 
     private SwingPropertyChangeSupport changeSupport;
 
@@ -170,7 +168,7 @@
      * Looks up the given key in our Hashtable and resolves LazyValues
      * or ActiveValues.
      */
-    private Object getFromHashtable(Object key) {
+    private Object getFromHashtable(final Object key) {
         /* Quickly handle the common case, without grabbing
          * a lock.
          */
--- a/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java	Tue Jan 20 10:22:44 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java	Tue Jan 20 11:23:03 2015 -0800
@@ -28,7 +28,6 @@
 import java.awt.*;
 import java.util.*;
 import javax.swing.*;
-import javax.swing.border.Border;
 import javax.swing.plaf.*;
 
 /**
@@ -44,7 +43,8 @@
  * @author Scott Violet
  */
 public class DefaultSynthStyle extends SynthStyle implements Cloneable {
-    private static final String PENDING = "Pending";
+
+    private static final Object PENDING = new Object();
 
     /**
      * Should the component be opaque?
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs1Test.java	Tue Jan 20 11:23:03 2015 -0800
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2007, 2014, 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 8054358
+ * @summary Check whether a set of dialogs created with a toolkit excluded Frame
+ *          parent has a proper modal blocking behavior. Also show a document modal
+ *          dialog and check if it blocks the document properly.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main/timeout=500 MultipleDialogs1Test
+ */
+
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
+import java.util.Iterator;
+
+public class MultipleDialogs1Test {
+
+    private volatile CustomFrame frame;
+    private List<CustomDialog> dialogList;
+
+    private static int delay = 500;
+    private int dialogCount = -1;
+
+    public void createGUI() {
+
+        final int n = 8;
+        dialogList = new ArrayList<>();
+
+        frame = new CustomFrame();
+        frame.setLocation(50, 50);
+        frame.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
+        frame.setVisible(true);
+
+        int x = 250, y = 50;
+
+        CustomDialog dlg;
+
+        for (int i = 0; i < n - 1; ++i) {
+
+            dlg = new CustomDialog(frame);
+            dlg.setLocation(x, y);
+            x += 200;
+
+            if (x > 600) {
+                x = 50;
+                y += 200;
+            }
+
+            Dialog.ModalityType type;
+
+            if (i % 3 == 0) {
+                type = Dialog.ModalityType.MODELESS;
+            } else if (i % 3 == 1) {
+                type = Dialog.ModalityType.APPLICATION_MODAL;
+            } else {
+                type = Dialog.ModalityType.TOOLKIT_MODAL;
+            }
+
+            dlg.setModalityType(type);
+            dialogList.add(dlg);
+        }
+
+        dlg = new CustomDialog(frame);
+        dlg.setLocation(x, y);
+        dlg.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
+        dialogList.add(dlg);
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+            EventQueue.invokeAndWait(this::createGUI);
+
+            ExtendedRobot robot = new ExtendedRobot();
+            robot.waitForIdle(delay);
+
+            List<CustomDialog> dialogs = Collections.synchronizedList(dialogList);
+
+            final int n = dialogs.size();
+
+            synchronized(dialogs) {
+                for (int i = 0; i < n - 1; ++i) {
+
+                    frame.clickOpenButton(robot);
+                    robot.waitForIdle(delay);
+
+                    dialogs.get(i).checkUnblockedDialog(
+                        robot, i + ": This is " + getType(i) + ".");
+
+                    frame.checkUnblockedFrame(robot, i + ": Other dialogs are visible.");
+
+                    if (i > 0) {
+                        for (int j = 0; j < i; j++) {
+                            dialogs.get(j).checkUnblockedDialog(robot, j + ": A toolkit modality " +
+                                "excluded frame is a parent of this dialog.");
+                        }
+                    }
+                } // i
+
+                frame.clickOpenButton(robot);
+                robot.waitForIdle(delay);
+
+                dialogs.get(n - 1).checkUnblockedDialog(
+                    robot, (n - 1) + ": This is " + getType(n - 1) + ".");
+
+                frame.checkBlockedFrame(robot,
+                    "A document modal dialog with Frame parent is visible.");
+
+                for (int i = 0; i < n - 1; ++i) {
+                    dialogs.get(i).checkUnblockedDialog(robot,
+                        i + ": A document modal dialog should not block " +
+                        "this dialog. The parent is modality excluded.");
+                }
+
+                dialogs.get(n - 1).clickCloseButton(robot);
+                robot.waitForIdle(delay);
+
+                for (int i = 0; i < n - 1; ++i) {
+                    dialogs.get(i).checkUnblockedDialog(robot, i + ": A document modal " +
+                        "dialog which blocked this dialog was closed.");
+                }
+                frame.checkUnblockedFrame(robot,
+                    "A blocking document modal dialog was closed.");
+                robot.waitForIdle(delay);
+            } // synchronized
+
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll);
+        }
+    }
+
+    private String getType(int i) {
+
+        switch (dialogList.get(i).getModalityType()) {
+            case APPLICATION_MODAL:
+                return "an application modal dialog";
+            case DOCUMENT_MODAL:
+                return "a document modal dialog";
+            case TOOLKIT_MODAL:
+                return "a toolkit modal dialog";
+        }
+        return "a modeless dialog";
+    }
+
+    private void closeAll() {
+
+        if (frame != null) { frame.dispose(); }
+        if (dialogList != null) {
+            Iterator<CustomDialog> it = dialogList.iterator();
+            while (it.hasNext()) { it.next().dispose(); }
+        }
+    }
+
+    class CustomFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() {
+            if ((dialogList != null) && (dialogList.size() > dialogCount)) {
+                dialogCount++;
+                CustomDialog d = dialogList.get(dialogCount);
+                if (d != null) { d.setVisible(true); }
+            }
+        }
+    }
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Frame  f) { super(f); }
+        public CustomDialog(Dialog d) { super(d); }
+
+        @Override
+        public void doCloseAction() { this.dispose(); }
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        (new MultipleDialogs1Test()).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs2Test.java	Tue Jan 20 11:23:03 2015 -0800
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2007, 2014, 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 8054358
+ * @summary Check whether a set of dialogs created with an application excluded Frame
+ *          parent has a proper modal blocking behavior. Also show a document modal
+ *          dialog and check if it blocks the document properly.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main/timeout=500 MultipleDialogs2Test
+ */
+
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
+import java.util.Iterator;
+
+public class MultipleDialogs2Test {
+
+    private volatile CustomFrame frame;
+    private List<CustomDialog> dialogList;
+    private static final int delay = 500;
+
+    private int dialogCount = -1;
+
+    private void createGUI() {
+
+        final int n = 8;
+        dialogList = new ArrayList<>();
+
+        frame = new CustomFrame();
+        frame.setLocation(50, 50);
+        frame.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+        frame.setVisible(true);
+
+        CustomDialog dlg;
+
+        int x = 250, y = 50;
+        for (int i = 0; i < n - 1; ++i) {
+
+            dlg = new CustomDialog(frame);
+            dlg.setLocation(x, y);
+            x += 200;
+            if (x > 600) {
+                x = 50;
+                y += 200;
+            }
+
+            Dialog.ModalityType type;
+            if (i % 3 == 0) {
+                type = Dialog.ModalityType.MODELESS;
+            } else if (i % 3 == 1) {
+                type = Dialog.ModalityType.APPLICATION_MODAL;
+            } else {
+                type = Dialog.ModalityType.TOOLKIT_MODAL;
+            }
+            dlg.setModalityType(type);
+            dialogList.add(dlg);
+        }
+
+        dlg = new CustomDialog(frame);
+        dlg.setLocation(x, y);
+        dlg.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
+        dialogList.add(dlg);
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+            EventQueue.invokeAndWait(this::createGUI);
+
+            ExtendedRobot robot = new ExtendedRobot();
+            robot.waitForIdle(delay);
+
+            List<CustomDialog> dialogs = Collections.synchronizedList(dialogList);
+            final int n = dialogs.size();
+
+            synchronized(dialogs) {
+                for (int i = 0; i < n - 1; ++i) {
+
+                    frame.clickOpenButton(robot);
+                    robot.waitForIdle(delay);
+
+                    dialogs.get(i).checkUnblockedDialog(
+                        robot, i + ": This is " + getType(i) + ".");
+
+                    if (isToolkitModal(i)) {
+
+                        for (int j = 0; j < i; ++j) {
+                            dialogs.get(j).checkBlockedDialog(robot, j + ": This dialog " +
+                                "should be blocked by a toolkit modal dialog.");
+                        }
+
+                        frame.checkBlockedFrame(robot, i + ": A toolkit modal dialog " +
+                            "should block this application modality excluded frame.");
+
+                        break;
+
+                    } else {
+                        for (int j = 0; j < i; ++j) {
+                            dialogs.get(j).checkUnblockedDialog(robot,
+                                j + ": An application modality excluded frame " +
+                                "is the parent of this dialog.");
+                        }
+
+                        frame.checkUnblockedFrame(robot, i + ": The frame is " +
+                            "application modality excluded, but it is blocked.");
+                    }
+                }
+
+                int tkIndex = dialogCount; // continue testing
+                final int tk0 = tkIndex;
+
+                for (int i = tk0 + 1; i < n - 1; ++i) {
+
+                    dialogs.get(tkIndex).clickOpenButton(robot);
+                    robot.waitForIdle(delay);
+
+                    frame.checkBlockedFrame(robot, i + ": A toolkit modal dialog " +
+                        "should block this application modality excluded frame.");
+
+                    if (isToolkitModal(i)) {
+                        dialogs.get(i).checkUnblockedDialog(robot, i + ": This is " +
+                            "a toolkit modal dialog with blocked frame parent. " +
+                            "Another toolkit modal dialog is visible.");
+
+                        for (int j = 0; j < i; ++j) {
+                            dialogs.get(j).checkBlockedDialog(robot, j + ": " +
+                                "A toolkit modal dialog should block this child " +
+                                "dialog of application modality excluded frame.");
+                        }
+                        tkIndex = i;
+                    } else {
+                        dialogs.get(i).checkBlockedDialog(
+                            robot, i + ": This is " + getType(i) + " with blocked " +
+                            "Frame parent. Also, a toolkit modal dialog is visible.");
+
+                        for (int j = 0; j < i; ++j) {
+                            if (j != tkIndex) {
+                                dialogs.get(j).checkBlockedDialog(robot, j +
+                                    ": A toolkit modal dialog should block this " +
+                                    "child dialog of an application modality excluded frame.");
+                            }
+                        }
+                    }
+                }
+
+                // show a document modal dialog; the toolkit modal dialog should block it
+                dialogs.get(tkIndex).clickOpenButton(robot);
+                robot.waitForIdle(delay);
+
+                frame.checkBlockedFrame(robot, "A toolkit modal dialog is visible.");
+
+                for (int i = 0; i < n; ++i) {
+                    if (i == tkIndex) {
+                        dialogs.get(tkIndex).checkUnblockedDialog(robot,
+                            tkIndex + ": This is a toolkit modal dialog. " +
+                            "A document modal dialog is visible.");
+                    } else {
+                        dialogs.get(i).checkBlockedDialog(robot,
+                            i + ": A toolkit modal dialog should block this dialog.");
+                    }
+                }
+
+                dialogs.get(tk0 + 3).clickCloseButton(robot); // close 2nd toolkit dialog
+                robot.waitForIdle(delay);
+
+                for (int i = 0; i < n; ++i) {
+
+                    if (i == tk0 + 3) { continue; }
+                    if (i == tk0) {
+                        dialogs.get(i).checkUnblockedDialog(robot,
+                            i + ": This is a toolkit modal dialog. A blocking " +
+                            "toolkit modal dialog was opened and then closed.");
+                    } else {
+                        dialogs.get(i).checkBlockedDialog(robot,
+                            i + ": This dialog should be blocked by a toolkit modal dialog. " +
+                            "Another blocking toolkit modal dialog was closed.");
+                    }
+                }
+
+                dialogs.get(tk0).clickCloseButton(robot);
+                robot.waitForIdle(delay);
+
+                frame.checkBlockedFrame(
+                        robot, "A document modal dialog should block this Frame.");
+
+                for (int i = 0; i < n - 1; ++i) {
+                    if (!isToolkitModal(i)) {
+                        dialogs.get(i).checkUnblockedDialog(robot, i + ": The parent " +
+                            "of the dialog is an app modality excluded Frame.");
+                    }
+                }
+
+                dialogs.get(n - 1).clickCloseButton(robot);
+                robot.waitForIdle(delay);
+
+                frame.checkUnblockedFrame(robot, "A document modal dialog " +
+                    "blocking this Frame was closed.");
+
+                for (int i = 0; i < n - 1; ++i) {
+                    if (!isToolkitModal(i)) {
+                        dialogs.get(i).checkUnblockedDialog(robot, i + ": A document modal " +
+                            "dialog blocking the parent frame was closed.");
+                    }
+                }
+            } // synchronized
+
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll);
+        }
+    }
+
+    private boolean isToolkitModal(int i) { return (i % 3 == 2); }
+
+    private String getType(int i) {
+
+        switch (dialogList.get(i).getModalityType()) {
+            case APPLICATION_MODAL:
+                return "an application modal dialog";
+            case DOCUMENT_MODAL:
+                return "a document modal dialog";
+            case TOOLKIT_MODAL:
+                return "a toolkit modal dialog";
+        }
+        return "a modeless dialog";
+    }
+
+    public void closeAll() {
+
+        if (frame != null) { frame.dispose(); }
+        if (dialogList != null) {
+            Iterator<CustomDialog> it = dialogList.iterator();
+            while (it.hasNext()) { it.next().dispose(); }
+        }
+    }
+
+    class CustomFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() {
+            if ((dialogList != null) && (dialogList.size() > dialogCount)) {
+                dialogCount++;
+                CustomDialog d = dialogList.get(dialogCount);
+                if (d != null) { d.setVisible(true); }
+            }
+        }
+    }
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Frame frame) { super(frame); }
+
+        @Override
+        public void doCloseAction() { this.dispose(); }
+
+        @Override
+        public void doOpenAction() {
+            if ((dialogList != null) && (dialogList.size() > dialogCount)) {
+                dialogCount++;
+                if (dialogList.get(dialogCount) != null) {
+                    dialogList.get(dialogCount).setVisible(true);
+                }
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        (new MultipleDialogs2Test()).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs3Test.java	Tue Jan 20 11:23:03 2015 -0800
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2007, 2014, 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 8054358
+ * @summary Check correctness of modal blocking behavior for a chain of Dialogs
+ *          having different modality types with a Frame as a document root.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main/timeout=500 MultipleDialogs3Test
+ */
+
+
+import java.awt.*;
+import static jdk.testlibrary.Asserts.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
+import java.util.Iterator;
+
+
+public class MultipleDialogs3Test {
+
+    private volatile CustomFrame  frame;
+    private List<CustomDialog> dialogList;
+    private static int delay = 500;
+
+    private int dialogCount = -1;
+
+    public void createGUI() {
+
+        final int n = 8;
+        dialogList = new ArrayList<>();
+
+        frame = new CustomFrame();
+        frame.setLocation(50, 50);
+        frame.setVisible(true);
+
+        int x = 250;
+        int y = 50;
+        for (int i = 0; i < n; ++i) {
+
+            CustomDialog dlg;
+            if (i == 0) {
+                dlg = new CustomDialog(frame);
+            } else {
+                dlg = new CustomDialog(dialogList.get(i - 1));
+            }
+            dlg.setLocation(x, y);
+            x += 200;
+            if (x > 600) {
+                x = 50;
+                y += 200;
+            }
+
+            Dialog.ModalityType type;
+
+            if (i % 4 == 0) {
+                type = Dialog.ModalityType.MODELESS;
+            } else if (i % 4 == 1) {
+                type = Dialog.ModalityType.DOCUMENT_MODAL;
+            } else if (i % 4 == 2) {
+                type = Dialog.ModalityType.APPLICATION_MODAL;
+            } else {
+                type = Dialog.ModalityType.TOOLKIT_MODAL;
+            }
+
+            dlg.setModalityType(type);
+            dialogList.add(dlg);
+        }
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+            EventQueue.invokeAndWait(this::createGUI);
+
+            ExtendedRobot robot = new ExtendedRobot();
+            robot.waitForIdle(delay);
+
+            frame.clickOpenButton(robot);
+            robot.waitForIdle(delay);
+
+            List<CustomDialog> dialogs = Collections.synchronizedList(dialogList);
+            final int n = dialogs.size();
+
+            synchronized(dialogs) {
+                for (int i = 0; i < n; ++i) {
+                    dialogs.get(i).activated.waitForFlagTriggered();
+                    assertTrue(dialogs.get(i).activated.flag(), i + ": Dialog did not " +
+                        "trigger windowActivated event when it became visible.");
+
+                    dialogs.get(i).closeGained.waitForFlagTriggered();
+                    assertTrue(dialogs.get(i).closeGained.flag(), i + ": Close button " +
+                        "did not gain focus when Dialog became visible.");
+
+                    assertTrue(dialogs.get(i).closeButton.hasFocus(), i +
+                        ": Close button gained focus but then lost it.");
+
+                    dialogs.get(i).checkUnblockedDialog(robot,
+                        i + ": The dialog shouldn't be blocked.");
+
+                    if (i == 0) {
+                        assertTrue(dialogs.get(0).getModalityType() ==
+                            Dialog.ModalityType.MODELESS, "0: invalid modality type.");
+
+                        frame.checkUnblockedFrame(robot, i + ": A modeless dialog was " +
+                            "shown, but the parent frame became blocked.");
+
+                    } else {
+                        if (i % 4 == 0) { // modeless dialog
+                            assertTrue(dialogs.get(i).getModalityType() ==
+                                Dialog.ModalityType.MODELESS, i +
+                                ": incorrect dialog modality type.");
+
+                            dialogs.get(i - 1).checkUnblockedDialog(robot, i + ": A modeless " +
+                                "dialog was shown, but the parent dialog became blocked.");
+
+                            if (i > 0) {
+                                for (int j = 0; j < i - 1; ++j) {
+
+                                    dialogs.get(j).checkBlockedDialog(robot, i + ", " + j +
+                                        ": Showing a modeless dialog as a child of a " +
+                                        "modal dialog unblocked some dialog in its hierarchy.");
+                                }
+                            }
+                        } else {
+
+                            for (int j = 0; j < i; ++j) {
+
+                                dialogs.get(j).checkBlockedDialog(robot, i + ", " + j +
+                                    ": A modal dialog was shown, but some dialog " +
+                                    "in its hierarchy became unblocked.");
+                            }
+                        }
+
+                        frame.checkBlockedFrame(robot, i + ": A modal was dialog shown, " +
+                            "but the document root frame became unblocked.");
+                    }
+
+                    if (i != n - 1) {
+                        dialogs.get(i).clickOpenButton(robot);
+                        robot.waitForIdle(delay);
+                    }
+                }
+
+                for (int i = n - 1; i >= 0; --i) {
+
+                    resetAll();
+                    dialogs.get(i).clickCloseButton(robot);
+                    robot.waitForIdle(delay);
+
+                    if (i > 0) {
+
+                        dialogs.get(i - 1).activated.waitForFlagTriggered();
+                        assertTrue(dialogs.get(i - 1).activated.flag(), i + ": Dialog " +
+                            "was not activated when a child dialog was closed.");
+
+                        if (i == 1) {
+
+                            frame.checkUnblockedFrame(robot, "1: Frame having " +
+                                "a child modeless dialog was blocked.");
+
+                            dialogs.get(0).checkUnblockedDialog(robot,
+                                "0: A modeless dialog at the bottom " +
+                                "of the hierarchy was blocked.");
+
+                        } else if ((i - 1) % 4 == 0) { // dialog[i - 1] is modeless
+
+                            for (int j = 0; j < i - 2; ++j) {
+
+                                dialogs.get(j).checkBlockedDialog(robot, i + ", " + j +
+                                    ": A dialog in the hierarchy was not blocked. " +
+                                    "A dialog blocking a modeless dialog was closed.");
+                            }
+
+                            dialogs.get(i - 2).checkUnblockedDialog(robot, i + ": A modal " +
+                                "dialog having a child modeless dialog was blocked.");
+
+                            dialogs.get(i - 1).checkUnblockedDialog(robot, i + ": A modeless " +
+                                "dialog at the bottom of the hierarchy was blocked.");
+
+                            frame.checkBlockedFrame(robot, i +
+                                ": Frame having a child modal dialog was not blocked.");
+
+                        } else {
+                            for (int j = 0; j <= i - 2; ++j) {
+                                dialogs.get(j).checkBlockedDialog(robot, i + ", " + j +
+                                    ": A dialog in the hierarchy was not blocked. " +
+                                    "A child dialog was closed.");
+                            }
+
+                            dialogs.get(i - 1).checkUnblockedDialog(robot, (i - 1) +
+                                ": A dialog was not unblocked when the modal dialog was closed.");
+
+                            frame.checkBlockedFrame(robot, i + ": Frame having " +
+                                "a child modal dialog was not blocked. " +
+                                "Another child dialog was closed.");
+                        }
+                    } else {
+                        frame.activated.waitForFlagTriggered();
+                        assertTrue(frame.activated.flag(), i + ": Frame was not " +
+                            "activated when a child dialog was closed.");
+                    }
+                }
+            } // synchronized
+
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll);
+        }
+    }
+
+    private void resetAll() {
+        frame.resetStatus();
+        Iterator<CustomDialog> it = dialogList.iterator();
+        while (it.hasNext()) { it.next().resetStatus(); }
+    }
+
+    public void closeAll() {
+        if (frame != null) { frame.dispose(); }
+        if (dialogList != null) {
+            Iterator<CustomDialog> it = dialogList.iterator();
+            while (it.hasNext()) { it.next().dispose(); }
+        }
+    }
+
+    class CustomFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() {
+            if ((dialogList != null) && (dialogList.size() > dialogCount)) {
+                dialogCount++;
+                CustomDialog d = dialogList.get(dialogCount);
+                if (d != null) { d.setVisible(true); }
+            }
+        }
+    }
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Frame frame)   { super(frame); }
+        public CustomDialog(Dialog dialog) { super(dialog); }
+
+        @Override
+        public void doCloseAction() { this.dispose(); }
+
+        @Override
+        public void doOpenAction() {
+            if ((dialogList != null) && (dialogList.size() > dialogCount)) {
+                dialogCount++;
+                CustomDialog d = dialogList.get(dialogCount);
+                if (d != null) { d.setVisible(true); }
+            }
+        }
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        (new MultipleDialogs3Test()).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs4Test.java	Tue Jan 20 11:23:03 2015 -0800
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2007, 2014, 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 8054358 8055003
+ * @summary Check whether application and document modality levels for Dialog
+ *          work properly. Also check whether the blocking dialogs are
+ *          opening on top of the windows they block.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @run main MultipleDialogs4Test
+ */
+
+
+import java.awt.*;
+import static jdk.testlibrary.Asserts.*;
+
+
+public class MultipleDialogs4Test {
+
+    private volatile TopLevelFrame frame;
+    private volatile CustomFrame   secondFrame;
+    private volatile TestFrame     thirdFrame;
+    private volatile TestDialog    dialog, secondDialog, docChildDialog, appChildDialog;
+
+    private static final int delay = 500;
+
+
+    private void createGUI() {
+
+        frame = new TopLevelFrame();
+        frame.setLocation(50, 50);
+        frame.setVisible(true);
+
+        dialog = new TestDialog((Dialog) null);
+        dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
+        dialog.setLocation(150, 50);
+
+        appChildDialog = new TestDialog(dialog);
+        appChildDialog.setLocation(150, 90);
+
+        secondFrame = new CustomFrame();
+        secondFrame.setLocation(50, 250);
+
+        secondDialog = new TestDialog(secondFrame);
+        secondDialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
+        secondDialog.setLocation(150, 250);
+
+        docChildDialog = new TestDialog(secondFrame);
+        docChildDialog.setBackground(Color.black);
+        docChildDialog.setLocation(250, 250);
+
+        thirdFrame = new TestFrame();
+        thirdFrame.setLocation(250, 50);
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+            EventQueue.invokeAndWait(this::createGUI);
+
+            final int nAttempts = 3;
+            ExtendedRobot robot = new ExtendedRobot();
+            robot.waitForIdle(delay);
+
+            frame.clickOpenButton(robot);
+            robot.waitForIdle(delay);
+
+            secondFrame.clickOpenButton(robot);
+            robot.waitForIdle(delay);
+
+            secondFrame.checkBlockedFrame(robot,
+                "A document modal dialog should block this Frame.");
+
+            secondDialog.checkUnblockedDialog(robot, "This is a document " +
+                "modal dialog. No window blocks it.");
+
+            frame.checkUnblockedFrame(robot,
+                "There are no dialogs blocking this Frame.");
+
+            frame.clickCloseButton(robot);
+            robot.waitForIdle(delay);
+
+            frame.clickDummyButton(robot, nAttempts, false,
+                "The frame still on top even after showing a modal dialog.");
+            robot.waitForIdle(delay);
+
+            EventQueue.invokeAndWait(() -> { thirdFrame.setVisible(true); });
+            robot.waitForIdle(delay);
+
+            dialog.clickDummyButton(robot);
+            robot.waitForIdle(delay);
+
+            secondDialog.clickDummyButton(
+                robot, nAttempts, false, "The document modal dialog " +
+                "was not blocked by an application modal dialog.");
+            robot.waitForIdle(delay);
+
+            EventQueue.invokeLater(() -> { docChildDialog.setVisible(true); });
+            robot.waitForIdle(delay);
+
+            Color c = robot.getPixelColor(
+                (int) secondDialog.getLocationOnScreen().x + secondDialog.getSize().width  - 25,
+                (int) secondDialog.getLocationOnScreen().y + secondDialog.getSize().height - 25);
+            assertFalse(c.equals(Color.black), "A dialog which should be blocked " +
+                "by document modal dialog overlapping it.");
+
+            EventQueue.invokeLater(() -> { appChildDialog.setVisible(true); });
+            robot.waitForIdle(delay);
+
+            appChildDialog.activated.waitForFlagTriggered();
+            assertTrue(appChildDialog.activated.flag(), "The child dialog of the " +
+                "application modal dialog still not visible.");
+            robot.waitForIdle(delay);
+
+            dialog.clickDummyButton(robot, nAttempts, false, "The child dialog of " +
+                "the application modal dialog did not overlap it.");
+            robot.waitForIdle(delay);
+
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll);
+        }
+    }
+
+    public void closeAll() {
+
+        if (frame != null) { frame.dispose(); }
+        if (dialog != null) { dialog.dispose(); }
+        if (appChildDialog != null) { appChildDialog.dispose(); }
+        if (secondFrame != null) { secondFrame.dispose(); }
+        if (secondDialog != null) { secondDialog.dispose(); }
+        if (docChildDialog != null) { docChildDialog.dispose(); }
+        if (thirdFrame != null) { thirdFrame.dispose(); }
+    }
+
+    class TopLevelFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() { secondFrame.setVisible(true); }
+        @Override
+        public void doCloseAction() { dialog.setVisible(true); }
+    }
+
+    class CustomFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() { secondDialog.setVisible(true); }
+    }
+
+    public static void main(String[] args) throws Exception {
+        (new MultipleDialogs4Test()).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/MultipleDialogs/MultipleDialogs5Test.java	Tue Jan 20 11:23:03 2015 -0800
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2007, 2014, 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 8054358
+ * @summary This is a simple check if a chain of dialogs having different
+  *         modality types block each other properly.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main MultipleDialogs5Test
+ */
+
+
+import java.awt.*;
+import static jdk.testlibrary.Asserts.*;
+
+
+public class MultipleDialogs5Test {
+
+    private volatile ParentFrame parent;
+    private volatile ModalDialog appDialog, docDialog, tkDialog;
+    private volatile CustomWindow window;
+
+    private static int delay = 500;
+
+    private void createGUI() {
+
+        parent = new ParentFrame();
+        parent.setLocation(50, 50);
+        parent.setVisible(true);
+
+        appDialog = new ModalDialog(parent);
+        appDialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
+        appDialog.setLocation(250, 50);
+
+        docDialog = new ModalDialog(appDialog);
+        docDialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
+        docDialog.setLocation(450, 50);
+
+        window = new CustomWindow(docDialog);
+        window.setLocation(50, 250);
+
+        tkDialog = new ModalDialog(docDialog);
+        tkDialog.setLocation(250, 250);
+        tkDialog.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL);
+
+        appDialog.setWindowToOpen(docDialog);
+        docDialog.setWindowToOpen(window);
+    }
+
+    public void doTest() throws Exception {
+
+         try {
+            EventQueue.invokeAndWait(this::createGUI);
+
+            ExtendedRobot robot = new ExtendedRobot();
+            robot.waitForIdle(delay);
+
+            parent.clickOpenButton(robot);
+            robot.waitForIdle(delay);
+
+            parent.checkBlockedFrame(robot,
+                "This Frame is blocked by an application modal dialog.");
+
+            appDialog.clickOpenButton(robot);
+            robot.waitForIdle(delay);
+
+            appDialog.checkBlockedDialog(robot,
+                "This Dialog is blocked by a document modal dialog.");
+
+            docDialog.clickOpenButton(robot);
+            robot.waitForIdle(delay);
+
+            docDialog.checkUnblockedDialog(robot,
+                "This Dialog is not blocked by any modal dialog.");
+
+            window.clickOpenButton(robot);
+            robot.waitForIdle(delay);
+
+            window.checkBlockedWindow(robot,
+                "This Window is blocked by a toolkit modal dialog.");
+
+            tkDialog.clickCloseButton(robot);
+            robot.waitForIdle(delay);
+            assertFalse(tkDialog.isVisible(),
+                "The toolkit modal dialog was not disposed.");
+
+            window.clickCloseButton(robot);
+            robot.waitForIdle(delay);
+            assertFalse(window.isVisible(),
+                "The window was not disposed.");
+
+            docDialog.clickCloseButton(robot);
+            robot.waitForIdle(delay);
+            assertFalse(docDialog.isVisible(),
+                "The document modal dialog was not disposed.");
+
+            appDialog.clickCloseButton(robot);
+            robot.waitForIdle(delay);
+            assertFalse(appDialog.isVisible(),
+                "The application modal dialog was not disposed.");
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll); // if something wasn't closed
+        }
+    }
+
+    private void closeAll() {
+
+        if (appDialog != null) { appDialog.dispose(); }
+        if (tkDialog  != null) {  tkDialog.dispose(); }
+        if (docDialog != null) { docDialog.dispose(); }
+        if (parent != null) { parent.dispose(); }
+        if (window != null) { window.dispose(); }
+    }
+
+    private class ParentFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() {
+            if (appDialog != null) { appDialog.setVisible(true); }
+        }
+    }
+
+    private class CustomWindow extends TestWindow {
+
+        public CustomWindow(Dialog d) { super(d); }
+
+        @Override
+        public void doOpenAction() {
+            if (tkDialog != null) { tkDialog.setVisible(true); }
+        }
+
+        @Override
+        public void doCloseAction() { this.dispose(); }
+    }
+
+    private class ModalDialog extends TestDialog {
+
+        private Window w;
+
+        public ModalDialog(Frame  f) { super(f); }
+        public ModalDialog(Dialog d) { super(d); }
+
+        public void setWindowToOpen(Window w) { this.w = w; }
+
+        @Override
+        public void doCloseAction() { this.dispose(); }
+
+        @Override
+        public void doOpenAction() {
+            if (w != null) { w.setVisible(true); }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        (new MultipleDialogs5Test()).doTest();
+    }
+}
--- a/jdk/test/java/awt/regtesthelpers/Util.java	Tue Jan 20 10:22:44 2015 -0800
+++ b/jdk/test/java/awt/regtesthelpers/Util.java	Tue Jan 20 11:23:03 2015 -0800
@@ -76,12 +76,17 @@
 public final class Util {
     private Util() {} // this is a helper class with static methods :)
 
+    private volatile static Robot robot;
+
     /*
      * @throws RuntimeException when creation failed
      */
     public static Robot createRobot() {
         try {
-            return new Robot();
+            if (robot == null) {
+                robot = new Robot();
+            }
+            return robot;
         } catch (AWTException e) {
             throw new RuntimeException("Error: unable to create robot", e);
         }
@@ -200,7 +205,10 @@
         return false;
     }
 
-    public static void waitForIdle(final Robot robot) {
+    public static void waitForIdle(Robot robot) {
+        if (robot == null) {
+            robot = createRobot();
+        }
         robot.waitForIdle();
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JButton/4796987/bug4796987.java	Tue Jan 20 11:23:03 2015 -0800
@@ -0,0 +1,102 @@
+/*
+ * 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 4796987
+ * @summary XP Only: JButton.setBorderPainted() does not work with XP L&F
+ * @author Alexander Scherbatiy
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main bug4796987
+ */
+
+import java.awt.*;
+import javax.swing.*;
+import sun.awt.OSInfo;
+import sun.awt.SunToolkit;
+import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
+
+public class bug4796987 {
+
+    private static JButton button1;
+    private static JButton button2;
+
+    public static void main(String[] args) throws Exception {
+        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS
+                && OSInfo.getWindowsVersion() == OSInfo.WINDOWS_XP) {
+            UIManager.setLookAndFeel(new WindowsLookAndFeel());
+            testButtonBorder();
+        }
+    }
+
+    private static void testButtonBorder() throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        toolkit.realSync();
+        Thread.sleep(500);
+
+        Point p1 = Util.getCenterPoint(button1);
+        Point p2 = Util.getCenterPoint(button2);
+
+        Color color = robot.getPixelColor(p1.x, p2.x);
+        for (int dx = p1.x; dx < p2.x - p1.x; dx++) {
+            robot.mouseMove(p1.x + dx, p1.y);
+            if (!color.equals(robot.getPixelColor(p1.x + dx, p1.y))) {
+                throw new RuntimeException("Button has border and background!");
+            }
+        }
+    }
+
+    private static JButton getButton() {
+        JButton button = new JButton();
+        button.setBorderPainted(false);
+        button.setFocusable(false);
+        return button;
+    }
+
+    private static void createAndShowGUI() {
+        JFrame frame = new JFrame("Test");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(200, 200);
+
+        JButton button = new JButton();
+        button.setBorder(null);
+
+        JPanel panel = new JPanel(new BorderLayout(50, 50));
+        panel.add(getButton(), BorderLayout.CENTER);
+        panel.add(button1 = getButton(), BorderLayout.WEST);
+        panel.add(button2 = getButton(), BorderLayout.EAST);
+        frame.getContentPane().add(panel);
+        frame.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JToolTip/6219960/bug6219960.java	Tue Jan 20 11:23:03 2015 -0800
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.GridLayout;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.AWTException;
+import java.awt.IllegalComponentStateException;
+import java.awt.event.InputEvent;
+import javax.swing.JButton;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.ToolTipManager;
+import javax.swing.table.DefaultTableModel;
+
+/**
+ * @test
+ * @bug 6219960
+ * @summary null reference in ToolTipManager
+ * @run main bug6219960
+ */
+public class bug6219960 {
+
+    private static final String QUESTION = "Question";
+
+    static volatile JFrame frame;
+    static JTable table;
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        SwingUtilities.invokeAndWait(bug6219960::createAndShowGUI);
+        robot.waitForIdle();
+        showModal("The tooltip should be showing. Press ok with mouse. And don't move it.");
+        robot.waitForIdle();
+        showModal("Now press ok and move the mouse inside the table (don't leave it).");
+        robot.waitForIdle();
+    }
+
+    private static void createAndShowGUI() {
+        ToolTipManager.sharedInstance().setDismissDelay(10 * 60 * 1000);
+        frame = new JFrame();
+        frame.setLocation(20, 20);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        JDesktopPane desk = new JDesktopPane();
+        JInternalFrame iframe = new JInternalFrame();
+        iframe.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
+        desk.add(iframe);
+        JButton save = new JButton();
+        save.setToolTipText("Wait for dialog to show.");
+        save.setText("Wait for the tooltip to show.");
+        JPanel panel = new JPanel(new GridLayout(1, 2));
+        panel.add(save);
+        table = createTable();
+        panel.add(new JScrollPane(table));
+        iframe.setContentPane(panel);
+        frame.getContentPane().add(desk);
+        frame.setSize(800, 600);
+        iframe.setSize(640, 480);
+        iframe.validate();
+        iframe.setVisible(true);
+        frame.validate();
+        frame.setVisible(true);
+        try {
+            iframe.setSelected(true);
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+
+        try {
+            Robot robot = new Robot();
+            Rectangle bounds = frame.getBounds();
+            int centerX = (int) (bounds.getX() + bounds.getWidth() / 6);
+            int centerY = (int) (bounds.getY() + bounds.getHeight() / 6);
+            robot.mouseMove(centerX, centerY);
+        } catch (AWTException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static void showModal(final String msg) throws Exception {
+
+        new Thread(() -> {
+
+            int timeout = 3000;
+            long endTime = System.currentTimeMillis() + timeout;
+
+            while (System.currentTimeMillis() <= endTime) {
+                if (pressOK(frame)) {
+                    return;
+                }
+            }
+            throw new RuntimeException("Internal frame has not been found!");
+        }).start();
+
+        Thread.sleep(900);
+
+        SwingUtilities.invokeAndWait(() -> {
+            JOptionPane.showInternalMessageDialog(table, msg,
+                    QUESTION,
+                    JOptionPane.PLAIN_MESSAGE);
+        });
+    }
+
+    private static JTable createTable() {
+        DefaultTableModel model = new DefaultTableModel();
+        JTable table = new JTable(model);
+        table.setFillsViewportHeight(true);
+        return table;
+    }
+
+    private static boolean pressOK(Component comp) {
+
+        JInternalFrame internalFrame
+                = findModalInternalFrame(comp, QUESTION);
+
+        if (internalFrame == null) {
+            return false;
+        }
+
+        JButton button = (JButton) findButton(internalFrame);
+
+        if (button == null) {
+            return false;
+        }
+
+        try {
+            Robot robot = new Robot();
+            Point location = button.getLocationOnScreen();
+            Rectangle bounds = button.getBounds();
+            int centerX = (int) (location.getX() + bounds.getWidth() / 2);
+            int centerY = (int) (location.getY() + bounds.getHeight() / 2);
+            robot.mouseMove(centerX, centerY);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        } catch (IllegalComponentStateException ignore) {
+            return false;
+        } catch (AWTException e) {
+            throw new RuntimeException(e);
+        }
+        return true;
+    }
+
+    private static JInternalFrame findModalInternalFrame(Component comp, String title) {
+
+        if (comp instanceof JInternalFrame) {
+            JInternalFrame internalFrame = (JInternalFrame) comp;
+            if (internalFrame.getTitle().equals(title)) {
+                return (JInternalFrame) comp;
+            }
+        }
+
+        if (comp instanceof Container) {
+            Container cont = (Container) comp;
+            for (int i = 0; i < cont.getComponentCount(); i++) {
+                JInternalFrame result = findModalInternalFrame(cont.getComponent(i), title);
+                if (result != null) {
+                    return result;
+                }
+            }
+        }
+        return null;
+    }
+
+    private static JButton findButton(Component comp) {
+
+        if (comp instanceof JButton) {
+            return (JButton) comp;
+        }
+
+        if (comp instanceof Container) {
+            Container cont = (Container) comp;
+            for (int i = 0; i < cont.getComponentCount(); i++) {
+                JButton result = findButton(cont.getComponent(i));
+                if (result != null) {
+                    return result;
+                }
+            }
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/UIDefaults/7180976/Pending.java	Tue Jan 20 11:23:03 2015 -0800
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+/**
+ * @test
+ * @bug 7180976
+ * @author Sergey Bylokhov
+ */
+public final class Pending implements Runnable {
+
+    private static volatile boolean passed;
+
+    public static void main(final String[] args) throws Exception {
+        SwingUtilities.invokeLater(new Pending());
+        Thread.sleep(10000);
+        if (!passed) {
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    @Override
+    public void run() {
+        UIManager.put("foobar", "Pending");
+        UIManager.get("foobar");
+        passed = true;
+    }
+}
\ No newline at end of file