Merge
authorddehaven
Tue, 31 Mar 2015 16:17:17 -0700
changeset 29737 97a7dda5a87c
parent 29725 52b259320d9e (current diff)
parent 29736 83a76fe84763 (diff)
child 29738 ac0aa9ac7043
child 29887 7dc39f3b8058
Merge
--- a/jdk/make/lib/Awt2dLibraries.gmk	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Tue Mar 31 16:17:17 2015 -0700
@@ -236,10 +236,6 @@
   LIBAWT_VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/java.desktop/windows/native/libawt/windows/awt.rc
 endif
 
-ifeq ($(MILESTONE), internal)
-  LIBAWT_CFLAGS += -DINTERNAL_BUILD
-endif
-
 LIBAWT_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt/mapfile-vers
 ifeq ($(OPENJDK_TARGET_OS), linux)
   LIBAWT_MAPFILE :=
@@ -347,10 +343,6 @@
       endif
     endif
 
-    ifeq ($(MILESTONE), internal)
-      LIBAWT_XAWT_CFLAGS += -DINTERNAL_BUILD
-    endif
-
     LIBAWT_XAWT_LDFLAGS_SUFFIX := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
 
     ifeq ($(OPENJDK_TARGET_OS), linux)
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java	Tue Mar 31 16:17:17 2015 -0700
@@ -44,7 +44,6 @@
 import sun.lwawt.macosx.*;
 
 public final class CFontManager extends SunFontManager {
-    private FontConfigManager fcManager = null;
     private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
 
     @Override
@@ -231,15 +230,6 @@
         return font2D;
     }
 
-    /*
-    public synchronized FontConfigManager getFontConfigManager() {
-        if (fcManager  == null) {
-            fcManager = new FontConfigManager();
-        }
-        return fcManager;
-    }
-    */
-
     protected void registerFontsInDir(String dirName, boolean useJavaRasterizer, int fontRank, boolean defer, boolean resolveSymLinks) {
         loadNativeDirFonts(dirName);
         super.registerFontsInDir(dirName, useJavaRasterizer, fontRank, defer, resolveSymLinks);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/NativeFont.java	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015, 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.font;
+
+import java.awt.FontFormatException;
+import java.awt.font.FontRenderContext;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+/*
+ * This class should never be invoked on the windows implementation
+ * So the constructor throws a FontFormatException, which is caught
+ * and the font is ignored.
+ */
+
+public class NativeFont extends PhysicalFont {
+
+    /**
+     * Verifies native font is accessible.
+     * @throws FontFormatException - if the font can't be located.
+     */
+    public NativeFont(String platName, boolean isBitmapDelegate)
+        throws FontFormatException {
+
+        throw new FontFormatException("NativeFont not used on OS X");
+    }
+
+    static boolean hasExternalBitmaps(String platName) {
+        return false;
+    }
+
+    public CharToGlyphMapper getMapper() {
+        return null;
+    }
+
+    PhysicalFont getDelegateFont() {
+        return null;
+    }
+
+    FontStrike createStrike(FontStrikeDesc desc) {
+        return null;
+    }
+
+    public Rectangle2D getMaxCharBounds(FontRenderContext frc) {
+        return null;
+    }
+
+    StrikeMetrics getFontMetrics(long pScalerContext) {
+        return null;
+    }
+
+    public GeneralPath getGlyphOutline(long pScalerContext,
+                                       int glyphCode,
+                                       float x, float y) {
+        return null;
+    }
+
+    public  GeneralPath getGlyphVectorOutline(long pScalerContext,
+                                              int[] glyphs, int numGlyphs,
+                                              float x, float y) {
+        return null;
+    }
+
+
+    long getGlyphImage(long pScalerContext, int glyphCode) {
+        return 0L;
+    }
+
+
+    void getGlyphMetrics(long pScalerContext, int glyphCode,
+                         Point2D.Float metrics) {
+    }
+
+
+    float getGlyphAdvance(long pScalerContext, int glyphCode) {
+        return 0f;
+    }
+
+    Rectangle2D.Float getGlyphOutlineBounds(long pScalerContext,
+                                            int glyphCode) {
+        return new Rectangle2D.Float(0f, 0f, 0f, 0f);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/NativeStrike.java	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015, 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.font;
+
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Point2D;
+import java.awt.Rectangle;
+import java.awt.geom.Rectangle2D;
+
+public class NativeStrike extends PhysicalStrike {
+
+    NativeFont nativeFont;
+
+    NativeStrike(NativeFont nativeFont, FontStrikeDesc desc) {
+        super(nativeFont, desc);
+
+        throw new RuntimeException("NativeFont not used on OS X");
+    }
+
+    NativeStrike(NativeFont nativeFont, FontStrikeDesc desc,
+                 boolean nocache) {
+        super(nativeFont, desc);
+
+        throw new RuntimeException("NativeFont not used on Windows");
+    }
+
+
+    void getGlyphImagePtrs(int[] glyphCodes, long[] images,int  len) {
+    }
+
+    long getGlyphImagePtr(int glyphCode) {
+        return 0L;
+    }
+
+    long getGlyphImagePtrNoCache(int glyphCode) {
+        return 0L;
+    }
+
+    void getGlyphImageBounds(int glyphcode,
+                             Point2D.Float pt,
+                             Rectangle result) {
+    }
+
+    Point2D.Float getGlyphMetrics(int glyphCode) {
+        return null;
+    }
+
+    float getGlyphAdvance(int glyphCode) {
+        return 0f;
+    }
+
+    Rectangle2D.Float getGlyphOutlineBounds(int glyphCode) {
+        return null;
+    }
+    GeneralPath getGlyphOutline(int glyphCode, float x, float y) {
+        return null;
+    }
+
+    GeneralPath getGlyphVectorOutline(int[] glyphs, float x, float y) {
+        return null;
+    }
+
+}
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Tue Mar 31 16:17:17 2015 -0700
@@ -311,7 +311,10 @@
 }
 
 - (BOOL) performKeyEquivalent: (NSEvent *) event {
-    [self deliverJavaKeyEventHelper: event];
+    // if IM is active key events should be ignored 
+    if (![self hasMarkedText] && !fInPressAndHold) {
+        [self deliverJavaKeyEventHelper: event];
+    }
 
     // Workaround for 8020209: special case for "Cmd =" and "Cmd ." 
     // because Cocoa calls performKeyEquivalent twice for these keystrokes  
--- a/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m	Tue Mar 31 16:17:17 2015 -0700
@@ -126,14 +126,28 @@
     return buf;
 }
 
+BOOL isSWTRunning() {
+    char envVar[80];
+    // If this property is present we are running SWT
+    snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
+    return getenv(envVar) != NULL;
+}
+
 char* SplashGetScaledImageName(const char* jar, const char* file,
                                float *scaleFactor) {
+    *scaleFactor = 1;
+
+    if(isSWTRunning()){
+        return nil;
+    }
+
     NSAutoreleasePool *pool = [NSAutoreleasePool new];
-    *scaleFactor = 1;
     char* scaledFile = nil;
     __block float screenScaleFactor = 1;
 
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+        // initialize NSApplication and AWT stuff
+        [NSApplicationAWT sharedApplication];
         screenScaleFactor = [SplashNSScreen() backingScaleFactor];
     }];
 
@@ -180,12 +194,8 @@
     splash->screenFormat.byteOrder = 1 ?  BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST;
     splash->screenFormat.depthBytes = 4;
 
-    // If this property is present we are running SWT and should not start a runLoop
-    // Can't check if running SWT in webstart, so splash screen in webstart SWT
-    // applications is not supported
-    char envVar[80];
-    snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
-    if (getenv(envVar) == NULL) {
+    // If we are running SWT we should not start a runLoop
+    if (!isSWTRunning()) {
         [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
             [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
         }];
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java	Tue Mar 31 16:17:17 2015 -0700
@@ -225,7 +225,7 @@
     }
 
     public short readShort() throws IOException {
-        if (read(byteBuf, 0, 2) < 0) {
+        if (read(byteBuf, 0, 2) != 2) {
             throw new EOFException();
         }
 
@@ -247,7 +247,7 @@
     }
 
     public int readInt() throws IOException {
-        if (read(byteBuf, 0, 4) < 0) {
+        if (read(byteBuf, 0, 4) !=  4) {
             throw new EOFException();
         }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Tue Mar 31 16:17:17 2015 -0700
@@ -308,14 +308,14 @@
     public Dimension getPreferredSize(JComponent c)  {
         recalculateIfInsetsChanged();
         Dimension d = new Dimension(contentRect.width, contentRect.height);
+        Insets i = slider.getInsets();
         if (slider.getOrientation() == JSlider.VERTICAL) {
             d.height = 200;
+            d.height += i.top + i.bottom;
         } else {
             d.width = 200;
+            d.width += i.left + i.right;
         }
-        Insets i = slider.getInsets();
-        d.width += i.left + i.right;
-        d.height += i.top + i.bottom;
         return d;
     }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Tue Mar 31 16:17:17 2015 -0700
@@ -439,6 +439,26 @@
         return tip;
     }
 
+    /**
+     * Returns the preferred size of the table header.
+     * This is the size required to display the header and requested for
+     * the viewport.
+     * The returned {@code Dimension} {@code width} will always be calculated by
+     * the underlying TableHeaderUI, regardless of any width specified by
+     * {@link JComponent#setPreferredSize(java.awt.Dimension)}
+     *
+     * @return the size
+     */
+    @Override
+    public Dimension getPreferredSize() {
+        Dimension preferredSize = super.getPreferredSize();
+        if (isPreferredSizeSet() && ui != null) {
+            Dimension size = ui.getPreferredSize(this);
+            if (size != null) preferredSize.width = size.width;
+        }
+        return preferredSize;
+    }
+
 //
 // Managing TableHeaderUI
 //
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Tue Mar 31 16:17:17 2015 -0700
@@ -368,9 +368,9 @@
     if (length > CONV_BUFFER_SIZE-1)
     {
         length = CONV_BUFFER_SIZE-1;
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
         fprintf(stderr, "Note: Detail is too long: %d chars\n", length);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
     }
 
     (*env)->GetStringUTFRegion(env, val, 0, length, convertionBuffer);
@@ -507,9 +507,9 @@
             }
         }
     } else {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
         fprintf(stderr, "Cannot load g_vfs_get_supported_uri_schemes\n");
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
     }
 
 }
@@ -522,23 +522,23 @@
      const char *gtk_version = fp_gtk_check_version(2, 14, 0);
      if (gtk_version != NULL) {
          // The gtk_show_uri is available from GTK+ 2.14
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
          fprintf (stderr, "The version of GTK is %s. "
              "The gtk_show_uri function is supported "
              "since GTK+ 2.14.\n", gtk_version);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
      } else {
          // Loading symbols only if the GTK version is 2.14 and higher
          fp_gtk_show_uri = dl_symbol("gtk_show_uri");
          const char *dlsym_error = dlerror();
          if (dlsym_error) {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
              fprintf (stderr, "Cannot load symbol: %s \n", dlsym_error);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
          } else if (fp_gtk_show_uri == NULL) {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
              fprintf(stderr, "dlsym(gtk_show_uri) returned NULL\n");
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
         } else {
             update_supported_actions(env);
             success = TRUE;
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	Tue Mar 31 16:17:17 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, 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
@@ -49,7 +49,7 @@
 
 #include <X11/XKBlib.h>
 
-#if defined(DEBUG) || defined(INTERNAL_BUILD)
+#if defined(DEBUG)
 static jmethodID lockIsHeldMID = NULL;
 
 static void
@@ -2346,4 +2346,3 @@
 
     (*env)->ReleaseIntArrayElements(env, bitmap, values, JNI_ABORT);
 }
-
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c	Tue Mar 31 16:17:17 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, 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
@@ -42,7 +42,7 @@
          // we are trying to load the library without a version suffix
          vfs_handle = dlopen(JNI_LIB_NAME("gnomevfs-2"), RTLD_LAZY);
          if (vfs_handle == NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
              fprintf(stderr, "can not load libgnomevfs-2.so\n");
  #endif
              return FALSE;
@@ -51,13 +51,13 @@
      dlerror(); /* Clear errors */
      gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
      if (gnome_vfs_init == NULL){
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
          fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n");
  #endif
          return FALSE;
      }
      if ((errmsg = dlerror()) != NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
          fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg);
  #endif
          return FALSE;
@@ -69,7 +69,7 @@
      if (gnome_handle == NULL) {
          gnome_handle = dlopen(JNI_LIB_NAME("gnome-2"), RTLD_LAZY);
          if (gnome_handle == NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
              fprintf(stderr, "can not load libgnome-2.so\n");
  #endif
              return FALSE;
@@ -78,7 +78,7 @@
      dlerror(); /* Clear errors */
      gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");
      if ((errmsg = dlerror()) != NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
          fprintf(stderr, "can not find symble gnome_url_show\n");
  #endif
          return FALSE;
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt.h	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt.h	Tue Mar 31 16:17:17 2015 -0700
@@ -228,7 +228,7 @@
 /*
  * checks if the current thread is/isn't the toolkit thread
  */
-#if defined(DEBUG) || defined(INTERNAL_BUILD)
+#if defined(DEBUG)
 #define CHECK_IS_TOOLKIT_THREAD() \
   if (GetCurrentThreadId() != AwtToolkit::MainThread())  \
   { JNU_ThrowInternalError(env,"Operation is not permitted on non-toolkit thread!\n"); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.html	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, 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.
+-->
+
+<html>
+<!--  
+  @test
+  @bug        6271849
+  @summary    Tests that component in modal excluded Window which parent is blocked responses to mouse clicks.
+  @author     anton.tarasov@sun.com: area=awt.focus
+  @run        applet ModalExcludedWindowClickTest.html
+  -->
+<head>
+<title>ModalExcludedWindowClickTest</title>
+</head>
+<body>
+
+<h1>ModalExcludedWindowClickTest<br>Bug ID: 6272324</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="ModalExcludedWindowClickTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.java	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2005, 2015, 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       6271849
+  @summary   Tests that component in modal excluded Window which parent is blocked responses to mouse clicks.
+  @author    anton.tarasov@sun.com: area=awt.focus
+  @run       applet ModalExcludedWindowClickTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+
+public class ModalExcludedWindowClickTest extends Applet {
+    Robot robot;
+    Frame frame = new Frame("Frame");
+    Window w = new Window(frame);
+    Dialog d = new Dialog ((Dialog)null, "NullParentDialog", true);
+    Button button = new Button("Button");
+    boolean actionPerformed = false;
+
+    public static void main (String args[]) {
+        ModalExcludedWindowClickTest app = new ModalExcludedWindowClickTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"This is an AUTOMATIC test", "simply wait until it is done"});
+    }
+
+    public void start() {
+
+        if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+            Sysout.println("No testing on MToolkit.");
+            return;
+        }
+
+        button.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    actionPerformed = true;
+                    Sysout.println(e.paramString());
+                }
+            });
+
+        EventQueue.invokeLater(new Runnable() {
+                public void run() {
+                    frame.setSize(200, 200);
+                    frame.setVisible(true);
+
+                    w.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+                    w.add(button);
+                    w.setSize(200, 200);
+                    w.setLocation(230, 230);
+                    w.setVisible(true);
+
+                    d.setSize(200, 200);
+                    d.setLocation(0, 230);
+                    d.setVisible(true);
+
+                }
+            });
+
+        waitTillShown(d);
+
+        test();
+    }
+
+    void test() {
+        clickOn(button);
+        waitForIdle();
+        if (!actionPerformed) {
+            throw new RuntimeException("Test failed!");
+        }
+        Sysout.println("Test passed.");
+    }
+
+    void clickOn(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+
+        Sysout.println("Clicking " + c);
+
+        if (c instanceof Frame) {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+        } else {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+        }
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        waitForIdle();
+    }
+    void waitTillShown(Component c) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                c.getLocationOnScreen();
+                break;
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            } catch (IllegalComponentStateException e) {}
+        }
+    }
+    void waitForIdle() {
+        try {
+            robot.waitForIdle();
+            EventQueue.invokeAndWait( new Runnable() {
+                    public void run() {} // Dummy implementation
+                });
+        } catch(InterruptedException ie) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ie.printStackTrace();
+        } catch(InvocationTargetException ite) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ite.printStackTrace();
+        }
+
+        // wait longer...
+        robot.delay(200);
+    }
+}
+
+/****************************************************
+ 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
+{
+    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/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.html	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, 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.
+-->
+
+<html>
+<!--  
+  @test
+  @bug        6272324
+  @summary    Modal excluded Window which decorated parent is blocked should be non-focusable.
+  @author     anton.tarasov@sun.com: area=awt.focus
+  @run        applet NonFocusableBlockedOwnerTest.html
+  -->
+<head>
+<title>NonFocusableBlockedOwnerTest</title>
+</head>
+<body>
+
+<h1>NonFocusableBlockedOwnerTest<br>Bug ID: 6272324</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="NonFocusableBlockedOwnerTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2005, 2015, 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       6272324
+  @summary   Modal excluded Window which decorated parent is blocked should be non-focusable.
+  @author    anton.tarasov@sun.com: area=awt.focus
+  @run       applet NonFocusableBlockedOwnerTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+
+public class NonFocusableBlockedOwnerTest extends Applet {
+    Robot robot;
+    Frame frame = new Frame("Modal Blocked Frame");
+    Dialog dialog = new Dialog(frame, "Modal Dialog", true);
+    Window excluded = new Window(frame);
+    Button button = new Button("button");
+
+    public static void main(String[] args) {
+        NonFocusableBlockedOwnerTest app = new NonFocusableBlockedOwnerTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"This is an AUTOMATIC test", "simply wait until it is done"});
+    }
+
+    public void start() {
+
+        if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+            Sysout.println("No testing on MToolkit.");
+            return;
+        }
+
+        try {
+            EventQueue.invokeLater(new Runnable() {
+                public void run() {
+                    frame.setSize(300, 200);
+                    frame.setVisible(true);
+
+                    excluded.setSize(300, 200);
+                    excluded.setLocation(0, 400);
+                    excluded.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
+                    excluded.setLayout(new FlowLayout());
+                    excluded.add(button);
+                    excluded.setVisible(true);
+
+                    dialog.setSize(200, 100);
+                    dialog.setLocation(0, 250);
+                    dialog.setVisible(true);
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        waitTillShown(dialog);
+        clickOn(button);
+        if (frame == KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow()) {
+            throw new RuntimeException("Test failed!");
+        }
+        if (excluded == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow()) {
+            throw new RuntimeException("Test failed!");
+        }
+        if (button == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
+            throw new RuntimeException("Test failed!");
+        }
+        Sysout.println("Test passed.");
+    }
+
+    void clickOn(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+
+        Sysout.println("Clicking " + c);
+
+        if (c instanceof Frame) {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+        } else {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+        }
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        waitForIdle();
+    }
+
+    void waitTillShown(Component c) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                c.getLocationOnScreen();
+                break;
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            } catch (IllegalComponentStateException e) {}
+        }
+    }
+    void waitForIdle() {
+        try {
+            robot.waitForIdle();
+            EventQueue.invokeAndWait( new Runnable() {
+                    public void run() {} // Dummy implementation
+                });
+        } catch(InterruptedException ie) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ie.printStackTrace();
+        } catch(InvocationTargetException ite) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ite.printStackTrace();
+        }
+
+        // wait longer...
+        robot.delay(200);
+    }
+}
+
+/****************************************************
+ 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
+{
+    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/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.html	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, 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.
+-->
+
+<html>
+<!--
+  @test
+  @bug        6253913
+  @summary    Tests that a Window shown before its owner is focusable.
+  @author     anton.tarasov@sun.com: area=awt-focus
+  @run        applet WindowUpdateFocusabilityTest.html
+  -->
+<head>
+<title>WindowUpdateFocusabilityTest</title>
+</head>
+<body>
+ 
+<h1>WindowUpdateFocusabilityTest<br>Bug ID: 6253913</h1>
+ 
+<p>See the dialog box (usually in upper left corner) for instructions</p>
+ 
+<APPLET CODE=WindowUpdateFocusabilityTest.class WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 2005, 2015, 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       6253913
+  @summary   Tests that a Window shown before its owner is focusable.
+  @author    anton.tarasov@sun.com: area=awt-focus
+  @run       applet WindowUpdateFocusabilityTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.lang.reflect.*;
+
+public class WindowUpdateFocusabilityTest extends Applet {
+    Robot robot;
+    boolean focusGained = false;
+    final Object monitor = new Object();
+    FocusListener listener = new FocusAdapter () {
+            public void focusGained(FocusEvent e) {
+                Sysout.println(e.toString());
+                synchronized (monitor) {
+                    focusGained = true;
+                    monitor.notifyAll();
+                }
+            }
+        };
+
+    public static void main(String[] args) {
+        WindowUpdateFocusabilityTest app = new WindowUpdateFocusabilityTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: couldn't create robot");
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"This is an automatic test. Simply wait until it's done."});
+    }
+
+    public void start() {
+        if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+            Sysout.println("No testing on Motif.");
+            return;
+        }
+
+        test(new Frame("Frame owner"));
+        Frame dialog_owner = new Frame("dialog's owner");
+        test(new Dialog(dialog_owner));
+        test(new Dialog(dialog_owner, Dialog.ModalityType.DOCUMENT_MODAL));
+        test(new Dialog(dialog_owner, Dialog.ModalityType.APPLICATION_MODAL));
+        test(new Dialog(dialog_owner, Dialog.ModalityType.TOOLKIT_MODAL));
+        test(new Dialog((Window) null, Dialog.ModalityType.MODELESS));
+        test(new Dialog((Window) null, Dialog.ModalityType.DOCUMENT_MODAL));
+        test(new Dialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL));
+        test(new Dialog((Window) null, Dialog.ModalityType.TOOLKIT_MODAL));
+        dialog_owner.dispose();
+    }
+
+    private void test(final Window owner)
+    {
+        Window window0 = new Window(owner); // will not be shown
+        Window window1 = new Window(window0);
+        Window window2 = new Window(window1);
+        Button button1 = new Button("button1");
+        Button button2 = new Button("button2");
+        button1.addFocusListener(listener);
+        button2.addFocusListener(listener);
+
+        owner.setBounds(800, 0, 100, 100);
+        window1.setBounds(800, 300, 100, 100);
+        window2.setBounds(800, 150, 100, 100);
+
+        window1.add(button1);
+        window2.add(button2);
+
+        window2.setVisible(true);
+        window1.setVisible(true);
+        EventQueue.invokeLater(new Runnable() {
+                public void run() {
+                    owner.setVisible(true);
+                }
+            });
+
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                    public void run() {
+                        // do nothing just wait until previous invokeLater will be executed
+                    }
+                });
+        } catch (InterruptedException ie) {
+            throw new RuntimeException(ie);
+        } catch (InvocationTargetException ite) {
+            throw new RuntimeException(ite);
+        }
+
+        robot.delay(1000);
+
+        clickOn(button1);
+
+        if (!isFocusGained()) {
+            throw new RuntimeException("Test failed: window1 is not focusable!");
+        }
+
+        focusGained = false;
+        clickOn(button2);
+
+        if (!isFocusGained()) {
+            throw new RuntimeException("Test failed: window2 is not focusable!");
+        }
+
+        Sysout.println("Test for " + owner.getName() + " passed.");
+        owner.dispose();
+    }
+
+    void clickOn(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+
+        Sysout.println("Clicking " + c);
+
+        robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        waitForIdle();
+    }
+
+    void waitForIdle() {
+        try {
+            robot.waitForIdle();
+            robot.delay(50);
+            EventQueue.invokeAndWait( new Runnable() {
+                    public void run() {} // Dummy implementation
+                });
+        } catch(InterruptedException ie) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ie.printStackTrace();
+        } catch(InvocationTargetException ite) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ite.printStackTrace();
+        }
+    }
+
+    boolean isFocusGained() {
+        synchronized (monitor) {
+            if (!focusGained) {
+                try {
+                    monitor.wait(3000);
+                } catch (InterruptedException e) {
+                    Sysout.println("Interrupted unexpectedly!");
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+        return focusGained;
+    }
+}
+
+/****************************************************
+ 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
+{
+    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
--- a/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java	Tue Mar 31 16:17:17 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -192,8 +192,7 @@
     }
     private void waitForIdle() {
         try {
-            Toolkit.getDefaultToolkit().sync();
-            sun.awt.SunToolkit.flushPendingEvents();
+            robot.waitForIdle();
             EventQueue.invokeAndWait( new Runnable() {
                                             public void run() {
                                                 // dummy implementation
--- a/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java	Tue Mar 31 16:17:17 2015 -0700
@@ -23,13 +23,16 @@
 
 import java.awt.Color;
 import java.awt.Dialog;
+import java.awt.Frame;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Panel;
 import java.awt.Rectangle;
 import java.awt.Robot;
 import java.awt.SplashScreen;
+import java.awt.TextField;
 import java.awt.Window;
+import java.awt.event.KeyEvent;
 import java.awt.image.BufferedImage;
 import java.io.File;
 import javax.imageio.ImageIO;
@@ -37,7 +40,7 @@
 
 /**
  * @test
- * @bug 8043869
+ * @bug 8043869 8075244
  * @author Alexander Scherbatiy
  * @summary [macosx] java -splash does not honor 2x hi dpi notation for retina
  * support
@@ -45,6 +48,7 @@
  * @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0
  * @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1
  * @run main/othervm -splash:splash3. MultiResolutionSplashTest TEST_SPLASH 2
+ * @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_FOCUS
  */
 public class MultiResolutionSplashTest {
 
@@ -69,6 +73,9 @@
                 int index = Integer.parseInt(args[1]);
                 testSplash(tests[index]);
                 break;
+            case "TEST_FOCUS":
+                testFocus();
+                break;
             default:
                 throw new RuntimeException("Unknown test: " + test);
         }
@@ -92,12 +99,49 @@
         float scaleFactor = getScaleFactor();
         Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;
 
-        if (!testColor.equals(splashScreenColor)) {
+        if (!compare(testColor, splashScreenColor)) {
             throw new RuntimeException(
                     "Image with wrong resolution is used for splash screen!");
         }
     }
 
+    static void testFocus() throws Exception {
+
+        System.out.println("Focus Test!");
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        Frame frame = new Frame();
+        frame.setSize(100, 100);
+        String test = "123";
+        TextField textField = new TextField(test);
+        frame.add(textField);
+        frame.setVisible(true);
+        robot.waitForIdle();
+
+        robot.keyPress(KeyEvent.VK_A);
+        robot.keyRelease(KeyEvent.VK_A);
+        robot.keyPress(KeyEvent.VK_B);
+        robot.keyRelease(KeyEvent.VK_B);
+        robot.waitForIdle();
+
+        frame.dispose();
+
+        if(!textField.getText().equals("ab")){
+            throw new RuntimeException("Focus is lost!");
+        }
+    }
+
+    static boolean compare(Color c1, Color c2){
+        return compare(c1.getRed(), c2.getRed())
+                && compare(c1.getGreen(), c2.getGreen())
+                && compare(c1.getBlue(), c2.getBlue());
+    }
+
+    static boolean compare(int n, int m){
+        return Math.abs(n - m) <= 50;
+    }
+
     static float getScaleFactor() {
 
         final Dialog dialog = new Dialog((Window) null);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,795 @@
+/*
+ * Copyright (c) 2003, 2015, 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 4632143
+  @summary Unit test for the RFE window/frame/dialog always on top
+  @author dom@sparc.spb.su: area=awt.toplevel
+  @run main AutoTestOnTop
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+import javax.swing.*;
+import java.util.Vector;
+
+/**
+ * @author tav@sparc.spb.su
+ * @author dom@sparc.spb.su
+ * Tests that always-on-top windows combine correctly with different kinds of window in different styles and conditions.
+ *
+ * !!! WARNING !!!
+ * The test fails sometimes because the toFront() method doesn't guarantee
+ * that after its invocation the frame will be placed above all other windows.
+ */
+public class AutoTestOnTop {
+    static Window topw;
+    static Frame  parentw = new Frame();
+    static Window f;
+    static Frame  parentf = new Frame();
+
+    static Object  uncheckedSrc = new Object(); // used when no need to check event source
+    static Object  eventSrc = uncheckedSrc;
+    static boolean dispatchedCond;
+
+    static Semaphore STATE_SEMA = new Semaphore();
+    static Semaphore VIS_SEMA = new Semaphore();
+    static Vector errors = new Vector();
+
+    static boolean isUnix = false;
+
+    static StringBuffer msgError = new StringBuffer();
+    static StringBuffer msgCase = new StringBuffer();
+    static StringBuffer msgAction = new StringBuffer();
+    static StringBuffer msgFunc = new StringBuffer();
+    static StringBuffer msgVisibility = new StringBuffer();
+
+    static volatile int stageNum;
+    static volatile int actNum;
+    static volatile int testResult = 0;
+
+    static volatile boolean doCheckEvents;
+    static volatile boolean eventsCheckPassed;
+    static boolean[] eventsCheckInitVals = new boolean[] { // Whether events are checked for abcence or precence
+        true, true, true, true, true, false, false, false, false
+    };
+    static String[] msgEventsChecks = new String[] {
+        null, null, null, null, null,
+        "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+        "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+        "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+        "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+    };
+
+    static final int stagesCount = 7;
+    static final int actionsCount = 9;
+
+    static Method[] preActions = new Method[actionsCount];
+    static Method[] postActions = new Method[actionsCount];
+    static Method[] isActionsAllowed = new Method[actionsCount];
+    static Method[] checksActionEvents = new Method[actionsCount];
+
+    static Robot robot;
+
+    static boolean doStartTest;
+    static String osName = System.getProperty("os.name");
+
+
+    public static void main(String[] args) {
+        checkTesting();
+
+    }
+
+    public static void performTesting() {
+        isUnix = osName.equals("Linux") || osName.equals("SunOS");
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+                public void eventDispatched(AWTEvent e) {
+                    if (e.getID() == MouseEvent.MOUSE_CLICKED) {
+                        if (eventSrc != null & eventSrc != uncheckedSrc && e.getSource() != eventSrc) {
+                            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": " + msgError);
+                            testResult = -1;
+                        }
+                        synchronized (eventSrc) {
+                            dispatchedCond = true;
+                            eventSrc.notify();
+                        }
+                    }
+
+                    if (doCheckEvents && (e.getSource() == topw || e.getSource() == f)) {
+
+                        //System.err.println("AWTEventListener: catched the event " + e);
+
+                        try {
+                            checksActionEvents[actNum].invoke(null, new Object[] {e});
+                        } catch (InvocationTargetException ite) {
+                            ite.printStackTrace();
+                        } catch (IllegalAccessException iae) {
+                            iae.printStackTrace();
+                        }
+                        return;
+                    }
+                }
+            }, 0xffffffffffffffffL);
+
+        Method[] allMethods;
+
+        try {
+            allMethods = AutoTestOnTop.class.getDeclaredMethods();
+        } catch (SecurityException se) {
+            throw new RuntimeException(se);
+        }
+
+        for (int i = 0; i < allMethods.length; i++) {
+            String name = allMethods[i].getName();
+            if (name.startsWith("preAction")) {
+                preActions[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+            } else if (name.startsWith("postAction")) {
+                postActions[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+            } else if (name.startsWith("isActionAllowed")) {
+                isActionsAllowed[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+            } else if (name.startsWith("checkActionEvents")) {
+                checksActionEvents[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+            }
+        }
+
+        f = new Frame("Auxiliary Frame");
+        f.setBounds(50, 0, 400, 50);
+        f.setVisible(true);
+        waitTillShown(f);
+
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+
+        mainTest();
+
+        if (testResult != 0) {
+            System.err.println("The following errors were encountered: ");
+            for (int i = 0; i < errors.size(); i++) {
+                System.err.println(errors.get(i).toString());
+            }
+            throw new RuntimeException("Test failed.");
+        } else {
+            System.err.println("Test PASSED.");
+        }
+    }
+
+    public static void mainTest() {
+//         stageNum = 0;
+//         for (int i = 0; i < 5; i++) {
+//             actNum = 2;
+//             System.err.println("************************* A C T I O N " + actNum + " *************************");
+//             doStage(stageNum, actNum);
+// //             pause(500);
+//             actNum = 3;
+//             System.err.println("************************* A C T I O N " + actNum + " *************************");
+//             doStage(stageNum, actNum);
+// //             pause(500);
+//         }
+        for (stageNum = 0; stageNum < stagesCount; stageNum++) {
+            System.err.println("************************* S T A G E " + stageNum + " *************************");
+            for (actNum = 0; actNum < actionsCount; actNum++) {
+                System.err.println("************************* A C T I O N " + actNum + " *************************");
+                doStage(stageNum, actNum);
+            } // for thru actNum
+        } // fow thru stageNum
+
+        eventSrc = null;
+    }
+
+    private static void doStage(int stageNum, int actNum) {
+        try {
+
+            if (!((Boolean)isActionsAllowed[actNum].invoke(null, new Object[0])).booleanValue()) {
+                System.err.println("Action skipped due to a platform limitations");
+                return;
+            }
+
+            STATE_SEMA.reset();
+            createWindow(stageNum);
+
+            //*************************
+            // Set window always-on-top
+            //*************************
+
+            preActions[actNum].invoke(null, new Object[0]);
+            setAlwaysOnTop(topw, true);
+            waitForIdle(true);
+
+            if (!topw.isAlwaysOnTopSupported()) return;
+
+            postActions[actNum].invoke(null, new Object[0]);
+            waitForIdle(false);
+
+            STATE_SEMA.reset();
+
+            testForAlwaysOnTop();
+
+            //*****************************
+            // Set window not always-on-top
+            //*****************************
+
+            preActions[actNum].invoke(null, new Object[0]);
+            setAlwaysOnTop(topw, false);
+            waitForIdle(true);
+            postActions[actNum].invoke(null, new Object[0]);
+            waitForIdle(false);
+            STATE_SEMA.reset();
+
+            testForNotAlwaysOnTop();
+
+        } catch (InvocationTargetException ite) {
+            ite.printStackTrace();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private static void checkTesting() {
+        if (Toolkit.getDefaultToolkit().isAlwaysOnTopSupported()) {
+            performTesting();
+        }
+    }
+
+    public static void testForAlwaysOnTop() {
+        System.err.println("Checking for always-on-top " + topw);
+
+        ensureInitialWinPosition(topw);
+
+        // Check that always-on-top window is topmost.
+        // - Click on always-on-top window on the windows cross area.
+        clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+                " window (1) always-on-top didn't make it topmost");
+
+        // Check that we can't change z-order of always-on-top window.
+        // - a) Try to put the other window on the top.
+        f.toFront();
+        clickOn(uncheckedSrc, f, 190, 30, ""); // coz toFront() works not always
+        pause(300);
+
+        // - b) Click on always-on-top window on the windows cross area.
+        clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+                " window (1) always-on-top didn't make it such");
+
+        // Ask for always-on-top property
+        if (isAlwaysOnTop(topw) != true)
+                error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase + ": " + msgAction +
+                                   ": isAlwaysOnTop() returned 'false' for window (1) set always-on-top at state "
+                                   + msgVisibility);
+    }
+
+    public static void testForNotAlwaysOnTop() {
+        System.err.println("Checking for non always-on-top of " + topw);
+        ensureInitialWinPosition(topw);
+
+        if (msgVisibility.equals("visible") && actNum != 2) {
+            // Check that the window remains topmost.
+            // - click on the window on the windows cross area.
+            clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+                    " window (1) not always-on-top didn't keep it topmost");
+        }
+
+        // Check that we can change z-order of not always-on-top window.
+        // - a) try to put the other window on the top.
+        f.toFront();
+        clickOn(uncheckedSrc, f, 190, 30, ""); // coz toFront() works not always
+        pause(300);
+
+        // - b) click on not always-on-top window on the windows cross area.
+        clickOn(f, f, 10, 30, "setting " + msgVisibility +
+                " window (1) not always-on-top didn't make it such");
+
+        // Ask for always-on-top property
+        if (isAlwaysOnTop(topw) != false)
+            error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase + ": " + msgAction +
+                               ": isAlwaysOnTop() returned 'true' for window (1) set not always-on-top at state "
+                               + msgVisibility);
+    }
+
+
+    private static void createWindow(int stageNum) {
+        // Free native resourses
+        if (topw != null && topw.isVisible()) {
+            topw.dispose();
+        }
+
+        switch (stageNum) {
+        case 0:
+            topw = new Frame("Top Frame");
+            msgCase.replace(0, msgCase.length(), "Frame (1) over Frame (2)");
+            break;
+        case 1:
+            topw = new JFrame("Top JFrame");
+            msgCase.replace(0, msgCase.length(), "JFrame (1) over Frame (2)");
+            break;
+        case 2:
+            topw = new Dialog(parentw, "Top Dialog");
+            msgCase.replace(0, msgCase.length(), "Dialog (1) over Frame (2)");
+            break;
+        case 3:
+            topw = new JDialog(parentw, "Top JDialog");
+            msgCase.replace(0, msgCase.length(), "JDialog (1) over Frame (2)");
+            break;
+        case 4:
+            topw = new Frame("Top Frame");
+            f.dispose();
+            f = new Dialog(parentf, "Auxiliary Dialog");
+            f.setBounds(50, 0, 250, 50);
+            f.setVisible(true);
+            waitTillShown(f);
+            msgCase.replace(0, msgCase.length(), "Frame (1) over Dialog (2)");
+            break;
+        case 5:
+            topw = new Window(parentw);
+            msgCase.replace(0, msgCase.length(), "Window (1) over Frame (2)");
+            break;
+        case 6:
+            topw = new JWindow(parentw);
+            msgCase.replace(0, msgCase.length(), "JWindow (1) over Frame (2)");
+            break;
+        }
+        topw.addWindowStateListener(new WindowAdapter() {
+                public void windowStateChanged(WindowEvent e) {
+                    System.err.println("* " + e);
+                    STATE_SEMA.raise();
+                }
+            });
+        topw.setSize(200, 50);
+    }
+
+    /**
+     * 0: setting always-on-top to invisible window
+     * 1: setting always-on-top to visible window
+     * 2: always-on-top on visible non-focusable window
+     * 3: always-on-top on visible, dragging topw after that
+     * 4: always-on-top on visible, dragging f after that
+     * 5: always-on-top on (visible, maximized), make normal after that
+     * 6: always-on-top on (visible, iconified), make normal after that
+     * 7: always-on-top on visible, iconify/deiconify after that
+     * 8: always-on-top on visible, maximize/restore after that
+     */
+    public static void preAction_0() {
+        topw.setVisible(false);
+    }
+    public static void postAction_0() {
+        if (topw.isShowing()) {
+            error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase +
+                               ": no actions with windows: changing always-on-top property at window (1) state 'invisible' makes window (1) visible");
+        }
+        setWindowVisible("no actions with windows", "invisible");
+    }
+    public static boolean isActionAllowed_0() {
+        // Window on Linux is always always-on-top!
+        return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount);
+    }
+    public static void checkActionEvents_0(AWTEvent e) {
+        System.err.println(e.toString());
+   }
+
+    public static void preAction_1() {
+        setWindowVisible("no actions with windows", "visible");
+    }
+    public static void postAction_1() {}
+    public static boolean isActionAllowed_1() {
+        return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount );
+    }
+    public static void checkActionEvents_1(AWTEvent e) {
+        System.err.println(e.toString());
+        if (e instanceof PaintEvent) {
+            return;
+        }
+        eventsCheckPassed = false;
+        error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                           ":  unexpected event " + e + " was generated");
+    }
+
+    public static void preAction_2() {
+        setWindowVisible("when window (1) set not focusable", "visible");
+        topw.setFocusableWindowState(false);
+        f.toFront();
+        pause(300);
+    }
+    public static void postAction_2() {}
+    public static boolean isActionAllowed_2() {
+        return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount);
+    }
+    public static void checkActionEvents_2(AWTEvent e) {
+        System.err.println(e.toString());
+        if ( (e.getID() >= FocusEvent.FOCUS_FIRST && e.getID() <= FocusEvent.FOCUS_LAST) ||
+             (e.getID() == WindowEvent.WINDOW_LOST_FOCUS && e.getID() == WindowEvent.WINDOW_GAINED_FOCUS)) {
+            eventsCheckPassed = false;
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " +
+                               msgAction + ": after call " + msgFunc +
+                               ": unexpected event " + e + " was generated");
+        }
+    }
+
+    public static void preAction_3() {
+        setWindowVisible("after dragging",  "visible");
+    }
+    public static void postAction_3() {
+        Point p = topw.getLocationOnScreen();
+        int x = p.x + 40, y = p.y + 5;
+
+        try {                      // Take a pause to avoid double click
+            Thread.sleep(500);     // when called one after another.
+        } catch (InterruptedException ie) {
+            ie.printStackTrace();
+        } catch (IllegalComponentStateException e) {
+            e.printStackTrace();
+        }
+
+        // Drag the window.
+        robot.mouseMove(x, y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseMove(200, 50);
+        robot.mouseMove(x, y);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+    }
+    public static boolean isActionAllowed_3() {
+        return (stageNum < 5);
+    }
+    public static void checkActionEvents_3(AWTEvent e) {
+        System.err.println(e.toString());
+    }
+
+    public static void preAction_4() {
+        setWindowVisible("after dragging window (2)",  "visible");
+    }
+    public static void postAction_4() {
+        Point p = f.getLocationOnScreen();
+        int x = p.x + 150, y = p.y + 5;
+
+        try {                      // Take a pause to avoid double click
+            Thread.sleep(500);     // when called one after another.
+        } catch (InterruptedException ie) {
+            ie.printStackTrace();
+        } catch (IllegalComponentStateException e) {
+            e.printStackTrace();
+        }
+
+        // Drag the window.
+        robot.mouseMove(x, y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseMove(200, 50);
+        robot.mouseMove(x, y);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        ensureInitialWinPosition(f);
+    }
+    public static boolean isActionAllowed_4() {
+        return !((stageNum == 5 || stageNum == 6) && isUnix);
+    }
+    public static void checkActionEvents_4(AWTEvent e) {
+        System.err.println(e.toString());
+    }
+
+    // Metacity has a bug not allowing to set a window to NORMAL state!!!
+
+    public static void preAction_5() {
+        setWindowVisible("at state 'maximized'",  "visible");
+        ((Frame)topw).setExtendedState(Frame.MAXIMIZED_BOTH);
+        waitForStateChange();
+    }
+    public static void postAction_5() {
+        ((Frame)topw).setExtendedState(Frame.NORMAL);
+        waitForStateChange();
+    }
+    public static boolean isActionAllowed_5() {
+        return (stageNum < 2);
+    }
+    public static void checkActionEvents_5(AWTEvent e) {
+        System.err.println("=" + e.toString());
+        if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+            eventsCheckPassed = true;
+        }
+    }
+
+    public static void preAction_6() {
+        setWindowVisible("at state 'iconified'",  "visible");
+        System.err.println("Iconifying " + topw);
+        ((Frame)topw).setExtendedState(Frame.ICONIFIED);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to ICONIFIED hasn't been generated");
+        }
+    }
+    public static void postAction_6() {
+        System.err.println("Restoring " + topw);
+        ((Frame)topw).setExtendedState(Frame.NORMAL);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to NORMAL hasn't been generated");
+        }
+    }
+    public static boolean isActionAllowed_6() {
+        return (stageNum < 2 );
+    }
+    public static void checkActionEvents_6(AWTEvent e) {
+        System.err.println("+" + e.toString());
+        if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+            eventsCheckPassed = true;
+        }
+    }
+
+    public static void preAction_7() {
+        setWindowVisible("before state 'iconified'",  "visible");
+    }
+    public static void postAction_7() {
+        System.err.println("Setting iconified");
+        ((Frame)topw).setExtendedState(Frame.ICONIFIED);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to ICONIFIED hasn't been generated");
+        }
+        System.err.println("Setting normal");
+        ((Frame)topw).setExtendedState(Frame.NORMAL);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to NORMAL hasn't been generated");
+        }
+    }
+    public static boolean isActionAllowed_7() {
+        return (stageNum < 2);
+    }
+    public static void checkActionEvents_7(AWTEvent e) {
+        System.err.println(e.toString());
+        if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+            eventsCheckPassed = true;
+        }
+    }
+
+    public static void preAction_8() {
+        setWindowVisible("before state 'maximized'",  "visible");
+    }
+    public static void postAction_8() {
+        ((Frame)topw).setExtendedState(Frame.MAXIMIZED_BOTH);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to MAXIMIZED hasn't been generated");
+        }
+        ((Frame)topw).setExtendedState(Frame.NORMAL);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to NORMAL hasn't been generated");
+        }
+    }
+    public static boolean isActionAllowed_8() {
+        return (stageNum < 2);
+    }
+    public static void checkActionEvents_8(AWTEvent e) {
+        System.err.println(e.toString());
+        if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+           eventsCheckPassed = true;
+        }
+    }
+
+    //***************************************************************************
+
+    private static void setWindowVisible(String mAction, String mVisibility) {
+        msgAction.replace(0, msgAction.length(), mAction);
+        msgVisibility.replace(0, msgVisibility.length(), mVisibility);
+
+        topw.setVisible(true);
+        pause(100); // Needs for Sawfish
+        topw.setLocation(0, 0);
+        waitTillShown(topw);
+        f.toFront();
+        pause(300);
+    }
+
+    private static void clickOn(Object src, Window relwin, int x, int y, String errorStr) {
+        Point p = relwin.getLocationOnScreen();
+        int counter = 10;
+        while (--counter > 0) {
+            eventSrc = src;
+            msgError.replace(0, msgError.length(), errorStr);
+
+            robot.mouseMove(p.x + x, p.y + y);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+            synchronized (eventSrc) {
+                if (!dispatchedCond) {
+                    try {
+                        eventSrc.wait(1000);
+                    } catch (InterruptedException e) {
+                        e.printStackTrace();
+                    }
+                }
+                if (!dispatchedCond) {
+                    //System.err.println("clickOn: MOUSE_CLICKED event losed, trying to generate it again...");
+                    continue;
+                }
+                dispatchedCond = false;
+            }
+            break;
+        } // end while
+        if (counter <= 0) {
+            eventSrc = uncheckedSrc;
+            error("Test: internal error: could't catch MOUSE_CLICKED event. Skip testing this stage");
+        }
+    }
+
+    private static void setAlwaysOnTop(Window w, boolean value) {
+        System.err.println("Setting always on top on " + w + " to " + value);
+        robot.mouseMove(0, 100); // Move out of the window
+        msgFunc.replace(0, msgCase.length(), "setAlwaysOnTop()");
+        try {
+            w.setAlwaysOnTop(value);
+        } catch (Exception e) {
+            error("Test failed: stage#" + stageNum + "action #" + actNum + ": " + msgCase + ": " + msgAction +
+                               ": setAlwaysOnTop(" + value + ") called at state " + msgVisibility +
+                               " threw exeption " + e);
+        }
+    }
+
+    private static boolean isAlwaysOnTop(Window w) {
+        robot.mouseMove(0, 100); // Move out of the window
+        msgFunc.replace(0, msgCase.length(), "isAlwaysOnTop()");
+        boolean result = false;
+        try {
+            result = w.isAlwaysOnTop();
+        } catch (Exception e) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction +
+                               ": isAlwaysOnTop() called at state " + msgVisibility +
+                               " threw exeption " + e);
+        }
+        return result;
+    }
+
+    private static void waitTillShown(Component c) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                c.getLocationOnScreen();
+                break;
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                break;
+            }
+        }
+    }
+
+    private static void waitForIdle(boolean doCheck) {
+        try {
+            robot.waitForIdle();
+            EventQueue.invokeAndWait( new Runnable() {
+                    public void run() {} // Dummy implementation
+                } );
+        } catch(InterruptedException ite) {
+            System.err.println("waitForIdle, non-fatal exception caught:");
+            ite.printStackTrace();
+        } catch(InvocationTargetException ine) {
+            System.err.println("waitForIdle, non-fatal exception caught:");
+            ine.printStackTrace();
+        }
+        doCheckEvents = doCheck;
+
+        if (doCheck) {
+            eventsCheckPassed = eventsCheckInitVals[actNum]; // Initialize
+        } else if (!eventsCheckPassed &&
+                 msgEventsChecks[actNum] != null) {
+
+
+            // Some expected event hasn't been catched,
+            // so give it one more chance...
+            doCheckEvents = true;
+            pause(500);
+            doCheckEvents = false;
+
+            if (!eventsCheckPassed) {
+                testResult = -1;
+                error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call "
+                                   + msgFunc + ": " + msgEventsChecks[actNum]);
+            }
+        }
+    }
+
+    private static boolean waitForStateChange() {
+        System.err.println("------- Waiting for state change");
+        try {
+            STATE_SEMA.doWait(3000);
+        } catch (InterruptedException ie) {
+            System.err.println("Wait interrupted: " + ie);
+        }
+        boolean state = STATE_SEMA.getState();
+        STATE_SEMA.reset();
+        return state;
+    }
+
+    private static void ensureInitialWinPosition(Window w) {
+        int counter = 30;
+        while (w.getLocationOnScreen().y != 0 && --counter > 0) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                break;
+            }
+        }
+        if (counter <= 0) {
+            w.setLocation(0, 0);
+            pause(100);
+            System.err.println("Test: window set to initial position forcedly");
+        }
+    }
+
+    private static void pause(int mls) {
+        try {
+            Thread.sleep(mls);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static void error(String msg) {
+        errors.add(msg);
+        System.err.println(msg);
+    }
+}
+
+class Semaphore {
+    boolean state = false;
+    int waiting = 0;
+    public Semaphore() {
+    }
+    public synchronized void doWait() throws InterruptedException {
+        if (state) {
+            return;
+        }
+        waiting++;
+        wait();
+        waiting--;
+    }
+    public synchronized void doWait(int timeout) throws InterruptedException {
+        if (state) {
+            return;
+        }
+        waiting++;
+        wait(timeout);
+        waiting--;
+    }
+    public synchronized void raise() {
+        state = true;
+        if (waiting > 0) {
+            notifyAll();
+        }
+    }
+
+    public synchronized void doNotify() {
+        notifyAll();
+    }
+    public synchronized boolean getState() {
+        return state;
+    }
+
+    public synchronized void reset() {
+        state = false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.html	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2004, 2015, 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.
+-->
+
+<html>
+<!--  
+  @test
+  @bug          4985250
+  @summary      COMPONENT_MOVED/RESIZED tardy events shouldn't be generated.
+  @author       tav@sparc.spb.su
+  @run applet MovedResizedTardyEventTest.html
+  -->
+<head>
+<title>MovedResizedTardyEventTest</title>
+</head>
+<body>
+
+<h1>MovedResizedTardyEventTest<br>Bug ID: 4985250</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="MovedResizedTardyEventTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.java	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2004, 2015, 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      4985250
+  @summary  COMPONENT_MOVED/RESIZED tardy events shouldn't be generated.
+  @author   tav@sparc.spb.su
+  @run applet MovedResizedTardyEventTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.lang.reflect.InvocationTargetException;
+
+public class MovedResizedTardyEventTest extends Applet {
+    Frame f1 = new Frame("F-1");
+    Frame f2 = new Frame("F-2");
+
+    boolean eventFlag = false;
+
+    public static void main(String[] args) {
+        Applet a = new MovedResizedTardyEventTest();
+        a.start();
+    }
+
+    public void start() {
+        f1.setVisible(true);
+        f2.setVisible(true);
+
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException e) {}
+
+        f1.addComponentListener(new ComponentAdapter() {
+                public void componentMoved(ComponentEvent e) {
+                    MovedResizedTardyEventTest.this.eventFlag = true;
+                    System.err.println(e);
+                }
+                public void componentResized(ComponentEvent e) {
+                    MovedResizedTardyEventTest.this.eventFlag = true;
+                    System.err.println(e);
+                }
+            });
+
+        f1.toFront();
+
+        waitForIdle();
+
+        try { // wait more...
+            Thread.sleep(500);
+        } catch (InterruptedException e) {}
+
+        if (eventFlag) {
+            throw new RuntimeException("Test failed!");
+        }
+    }
+
+    void waitForIdle() {
+        try {
+            (new Robot()).waitForIdle();
+            EventQueue.invokeAndWait( new Runnable() {
+                    public void run() {} // Dummy implementation
+                });
+        } catch(InterruptedException ie) {
+            System.err.println("waitForIdle, non-fatal exception caught:");
+            ie.printStackTrace();
+        } catch(InvocationTargetException ite) {
+            System.err.println("waitForIdle, non-fatal exception caught:");
+            ite.printStackTrace();
+        } catch(AWTException rex) {
+            rex.printStackTrace();
+            throw new RuntimeException("unexpected exception");
+        }
+    }
+}
--- a/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java	Tue Mar 31 16:17:17 2015 -0700
@@ -29,8 +29,6 @@
 @run main AltCharAcceleratorTest
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
@@ -103,13 +101,12 @@
     }
 
     void test() throws Exception {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Robot robot = new Robot();
+        robot.setAutoDelay(100);
+        robot.waitForIdle();
 
         focusLatch.await(5, TimeUnit.SECONDS);
 
-        Robot robot = new Robot();
-        robot.setAutoDelay(100);
-
         robot.keyPress(KeyEvent.VK_ALT);
         robot.keyPress(KeyEvent.VK_T);
         robot.keyRelease(KeyEvent.VK_T);
@@ -133,4 +130,4 @@
         AltCharAcceleratorTest t = new AltCharAcceleratorTest();
         t.test();
     }
-}
\ No newline at end of file
+}
--- a/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java	Tue Mar 31 16:17:17 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -24,18 +24,14 @@
 /*
   @test
   @bug 6799551
-  @library ../../regtesthelpers
-  @build Util Sysout
   @summary Extended key codes for small letters undefined
   @author Andrei Dmitriev: area=awt.keyboard
   @run main EqualKeyCode
 */
 
 
-import sun.awt.*;
 import java.awt.*;
-import test.java.awt.regtesthelpers.Util;
-import test.java.awt.regtesthelpers.Sysout;
+import java.awt.event.KeyEvent;
 
 public class EqualKeyCode {
 
@@ -46,13 +42,13 @@
             char cSmall = LETTERS.charAt(i);
             char cLarge = Character.toUpperCase(cSmall);
 
-            int iSmall = ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall);
-            int iLarge = ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge);
+            int iSmall = KeyEvent.getExtendedKeyCodeForChar(cSmall);
+            int iLarge = KeyEvent.getExtendedKeyCodeForChar(cLarge);
 
             System.out.print(" " + cSmall + ":" + iSmall + " ---- ");
             System.out.println(" " + cLarge + " : " + iLarge);
-            if (ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall) !=
-                ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge))
+            if (KeyEvent.getExtendedKeyCodeForChar(cSmall) !=
+                KeyEvent.getExtendedKeyCodeForChar(cLarge))
             {
                 throw new RuntimeException("ExtendedKeyCode doesn't exist or doesn't match between capital and small letters.");
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/stream/ShortStreamTest.java	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2015, 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     8074954
+ * @summary Test verifies that an IOException is triggered if input stream
+ *          does not contain enough data to read a multi-byte type.
+ *
+ * @run     main ShortStreamTest
+ */
+
+import javax.imageio.ImageIO;
+import javax.imageio.stream.ImageInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+public class ShortStreamTest {
+    public static void main(String[] args) throws IOException {
+        TestCase[]  tests = createTests();
+
+        for (TestCase t : tests) {
+            t.test();
+        }
+    }
+
+    private static abstract class TestCase {
+        abstract void testRead(ImageInputStream iis) throws IOException;
+
+        public void test() {
+            boolean gotException = false;
+
+            ImageInputStream iis = createShortStream();
+
+            try {
+                testRead(iis);
+            } catch (IOException e) {
+                e.printStackTrace(System.out);
+                gotException = true;
+            }
+
+            if (!gotException) {
+                throw new RuntimeException("Test failed.");
+            }
+            System.out.println("Test PASSED");
+        }
+    }
+
+
+    private static ImageInputStream createShortStream() {
+        try {
+            byte[] integerTestArray = new byte[] { 80 };
+            ByteArrayInputStream bais = new ByteArrayInputStream(integerTestArray);
+
+            return ImageIO.createImageInputStream(bais);
+        } catch (IOException e) {
+            return null;
+        }
+    }
+
+    private static TestCase[] createTests() {
+        return new TestCase[]{
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readInt();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readShort();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readDouble();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readFloat();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readLong();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readUnsignedInt();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readUnsignedShort();
+                    }
+                }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTableHeader/4473075/bug4473075.java	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2015, 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 4473075
+   @summary JTable header rendering problem (after setting preferred size)
+   @author Semyon Sadetsky
+*/
+
+import javax.swing.*;
+import javax.swing.table.DefaultTableModel;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class bug4473075 {
+    public static final int USER_HEADER_HEIGHT = 40;
+    private static JTable table;
+    private static JScrollPane scpScroll;
+    private static Point point;
+    private static JFrame frame;
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        robot.setAutoDelay(20);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame = new JFrame();
+                frame.setUndecorated(true);
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                table = new JTable();
+                String t = "a cell text";
+                table.setModel(new DefaultTableModel(
+                        new Object[][]{new Object[]{t, t, t, t, t}},
+                        new Object[]{t, t, t, t, t}));
+                table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+                scpScroll = new JScrollPane(table);
+
+                // Manually set preferred size of header...
+                Dimension preferredSize = new Dimension(table.getSize().width,
+                        USER_HEADER_HEIGHT);
+                table.getTableHeader().setPreferredSize(preferredSize);
+
+                frame.setContentPane(scpScroll);
+                frame.setSize(250, 480);
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+                point = scpScroll.getHorizontalScrollBar()
+                        .getLocationOnScreen();
+            }
+        });
+        robot.waitForIdle();
+
+        robot.mouseMove(point.x + 100, point.y + 5);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseMove(point.x + 150, point.y + 5);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        int headerH = table.getTableHeader().getHeight();
+        if (headerH != USER_HEADER_HEIGHT) {
+            throw new RuntimeException("TableHeader height was not set: "
+                    + headerH + " !=" + USER_HEADER_HEIGHT);
+        }
+
+        double tableX = table.getX();
+        int headerX = table.getTableHeader().getX();
+        if (tableX != headerX) {
+            throw new RuntimeException("TableHeader X position is wrong: "
+                    + tableX + " !=" + headerX);
+        }
+
+        double tableW = table.getWidth();
+        int headerW = table.getTableHeader().getWidth();
+        if (tableW != headerW) {
+            throw new RuntimeException("TableHeader width is wrong: "
+                    + tableW + " !=" + headerW);
+        }
+
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                frame.dispose();
+            }
+        });
+        System.out.println("ok");
+    }
+}
--- a/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java	Mon Mar 30 09:46:05 2015 -0700
+++ b/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java	Tue Mar 31 16:17:17 2015 -0700
@@ -28,8 +28,6 @@
    @run main bug7123767
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.plaf.metal.MetalLookAndFeel;
 import java.awt.*;
@@ -160,8 +158,10 @@
 
     // Moves mouse pointer to the corners of every GraphicsConfiguration
     private static void testToolTip() throws AWTException {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
+
+        robot = new Robot();
+        robot.setAutoDelay(20);
+        robot.waitForIdle();
 
         GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
         GraphicsDevice[] devices = environment.getScreenDevices();
@@ -169,28 +169,28 @@
             GraphicsConfiguration[] configs = device.getConfigurations();
             for (GraphicsConfiguration config : configs) {
                 Rectangle rect = config.getBounds();
-                Insets insets = toolkit.getScreenInsets(config);
+                Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(config);
                 adjustInsets(rect, insets);
 
                 // Upper left
                 glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                         rect.x + MARGIN, rect.y + MARGIN);
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 // Lower left
                 glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                         rect.x + MARGIN, rect.y + rect.height - MARGIN);
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 // Upper right
                 glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                         rect.x + rect.width - MARGIN, rect.y + MARGIN);
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 // Lower right
                 glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                         rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
-                toolkit.realSync();
+                robot.waitForIdle();
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/8040328/bug8040328.java	Tue Mar 31 16:17:17 2015 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015, 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 8040328
+   @summary JSlider has wrong preferred size with Synth LAF
+   @author Semyon Sadetsky
+*/
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import java.awt.*;
+import java.io.ByteArrayInputStream;
+
+public class bug8040328 {
+    private static String synthXml = "<synth>" +
+            " <style id=\"all\">" +
+            " <font name=\"Segoe UI\" size=\"12\"/>" +
+            " </style>" +
+            " <bind style=\"all\" type=\"REGION\" key=\".*\"/>" +
+            " <style id=\"slider\">" +
+            " <insets top=\"10\" left=\"5\" bottom=\"10\" right=\"5\"/>" +
+            " </style>" +
+            " <bind style=\"slider\" type=\"region\" key=\"Slider\"/>" +
+            "</synth>";
+
+    public static void main(String[] args) throws Exception {
+        SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
+        lookAndFeel.load(new ByteArrayInputStream(synthXml.getBytes("UTF8")),
+                bug8040328.class);
+        UIManager.setLookAndFeel(lookAndFeel);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                final JFrame frame = new JFrame();
+                try {
+                    frame.setUndecorated(true);
+                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                    frame.setVisible(true);
+                    test(frame);
+                } finally {
+                    frame.dispose();
+                }
+            }
+        });
+        System.out.println("ok");
+    }
+
+    static void test(JFrame frame) {
+        JSlider hslider = new JSlider(JSlider.HORIZONTAL);
+        hslider.setBackground(Color.DARK_GRAY);
+        frame.getContentPane().add(hslider, BorderLayout.CENTER);
+        frame.getContentPane().setBackground(Color.CYAN);
+        frame.pack();
+        Insets insets = hslider.getInsets();
+        if (hslider.getWidth() != 200 + insets.left + insets.right) {
+            throw new RuntimeException(
+                    "Horizontal slider width is wrong " + hslider.getWidth());
+        }
+        if (hslider.getHeight() != hslider.getMinimumSize().height) {
+            throw new RuntimeException(
+                    "Horizontal slider height is wrong " + hslider.getHeight());
+        }
+        frame.getContentPane().remove(hslider);
+
+        JSlider vslider = new JSlider(JSlider.VERTICAL);
+        frame.getContentPane().add(vslider);
+        frame.pack();
+        insets = vslider.getInsets();
+        if (vslider.getWidth() != vslider.getMinimumSize().width) {
+            throw new RuntimeException(
+                    "Verical slider width is wrong " + vslider.getWidth());
+        }
+        if (vslider.getHeight() != 200 + insets.top + insets.bottom) {
+            throw new RuntimeException(
+                    "Verical slider height is wrong " + vslider.getHeight());
+        }
+    }
+}