jdk/test/java/awt/regtesthelpers/Util.java
changeset 1171 a2782dd9f312
parent 2 90ce3da70b43
child 5506 202f599c92aa
--- a/jdk/test/java/awt/regtesthelpers/Util.java	Wed Jun 11 01:31:42 2008 -0700
+++ b/jdk/test/java/awt/regtesthelpers/Util.java	Tue Jun 17 13:37:28 2008 +0400
@@ -124,6 +124,14 @@
     }
 
     /**
+     * Makes the window visible and waits until it's shown.
+     */
+    public static void showWindowWait(Window win) {
+        win.setVisible(true);
+        waitTillShown(win);
+    }
+
+    /**
      * Moves mouse pointer in the center of given {@code comp} component
      * using {@code robot} parameter.
      */
@@ -574,4 +582,22 @@
     public static boolean trackActionPerformed(Button button, Runnable action, int time, boolean printEvent) {
         return trackEvent(ActionEvent.ACTION_PERFORMED, button, action, time, printEvent);
     }
+
+    /*
+     * Requests focus on the component provided and waits for the result.
+     * @return true if the component has been focused, false otherwise.
+     */
+    public static boolean focusComponent(Component comp, int time) {
+        return focusComponent(comp, time, false);
+    }
+    public static boolean focusComponent(final Component comp, int time, boolean printEvent) {
+        return trackFocusGained(comp,
+                                new Runnable() {
+                                    public void run() {
+                                        comp.requestFocus();
+                                    }
+                                },
+                                time, printEvent);
+
+    }
 }