test/javax/swing/JButton/4796987/bug4796987.java

Print this page

        

@@ -25,18 +25,19 @@
  * @test
  * @bug 4796987
  * @summary XP Only: JButton.setBorderPainted() does not work with XP L&F
  * @author Alexander Scherbatiy
  * @library ../../regtesthelpers
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @build Util
  * @run main bug4796987
  */
 
+import jdk.testlibrary.OSInfo;
 import java.awt.*;
 import javax.swing.*;
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
 
 public class bug4796987 {
 
     private static JButton button1;

@@ -49,22 +50,21 @@
             testButtonBorder();
         }
     }
 
     private static void testButtonBorder() throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
             public void run() {
                 createAndShowGUI();
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(500);
 
         Point p1 = Util.getCenterPoint(button1);
         Point p2 = Util.getCenterPoint(button2);