8074807: Fix some tests unnecessary using internal API
authoryan
Wed, 18 Mar 2015 10:30:22 +0300
changeset 29731 33a67f0e4374
parent 29730 eab36f5cc7ac
child 29732 56cf17d42243
8074807: Fix some tests unnecessary using internal API Reviewed-by: azvegint, alexsch
jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.html
jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.java
jdk/test/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.html
jdk/test/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java
jdk/test/java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.html
jdk/test/java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java
jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java
jdk/test/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java
jdk/test/java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.html
jdk/test/java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.java
jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java
jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java
jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.html	Wed Mar 18 10:30:22 2015 +0300
@@ -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	Wed Mar 18 10:30:22 2015 +0300
@@ -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	Wed Mar 18 10:30:22 2015 +0300
@@ -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	Wed Mar 18 10:30:22 2015 +0300
@@ -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	Wed Mar 18 10:30:22 2015 +0300
@@ -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	Wed Mar 18 10:30:22 2015 +0300
@@ -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	Tue Mar 17 15:18:11 2015 -0700
+++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java	Wed Mar 18 10:30:22 2015 +0300
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java	Wed Mar 18 10:30:22 2015 +0300
@@ -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	Wed Mar 18 10:30:22 2015 +0300
@@ -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	Wed Mar 18 10:30:22 2015 +0300
@@ -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	Tue Mar 17 15:18:11 2015 -0700
+++ b/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java	Wed Mar 18 10:30:22 2015 +0300
@@ -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	Tue Mar 17 15:18:11 2015 -0700
+++ b/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java	Wed Mar 18 10:30:22 2015 +0300
@@ -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.");
             }
--- a/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java	Tue Mar 17 15:18:11 2015 -0700
+++ b/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java	Wed Mar 18 10:30:22 2015 +0300
@@ -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();
             }
         }
     }