jdk/test/javax/swing/JButton/4796987/bug4796987.java
changeset 29514 973914c573fc
parent 28531 d0e5475bc8ed
child 31448 1066345d2a8a
equal deleted inserted replaced
29513:643ff69483e8 29514:973914c573fc
    25  * @test
    25  * @test
    26  * @bug 4796987
    26  * @bug 4796987
    27  * @summary XP Only: JButton.setBorderPainted() does not work with XP L&F
    27  * @summary XP Only: JButton.setBorderPainted() does not work with XP L&F
    28  * @author Alexander Scherbatiy
    28  * @author Alexander Scherbatiy
    29  * @library ../../regtesthelpers
    29  * @library ../../regtesthelpers
       
    30  * @library ../../../../lib/testlibrary
       
    31  * @build jdk.testlibrary.OSInfo
    30  * @build Util
    32  * @build Util
    31  * @run main bug4796987
    33  * @run main bug4796987
    32  */
    34  */
    33 
    35 
       
    36 import jdk.testlibrary.OSInfo;
    34 import java.awt.*;
    37 import java.awt.*;
    35 import javax.swing.*;
    38 import javax.swing.*;
    36 import sun.awt.OSInfo;
       
    37 import sun.awt.SunToolkit;
       
    38 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
    39 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
    39 
    40 
    40 public class bug4796987 {
    41 public class bug4796987 {
    41 
    42 
    42     private static JButton button1;
    43     private static JButton button1;
    49             testButtonBorder();
    50             testButtonBorder();
    50         }
    51         }
    51     }
    52     }
    52 
    53 
    53     private static void testButtonBorder() throws Exception {
    54     private static void testButtonBorder() throws Exception {
    54         SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
       
    55         Robot robot = new Robot();
    55         Robot robot = new Robot();
    56         robot.setAutoDelay(50);
    56         robot.setAutoDelay(50);
    57 
    57 
    58         SwingUtilities.invokeAndWait(new Runnable() {
    58         SwingUtilities.invokeAndWait(new Runnable() {
    59 
    59 
    60             public void run() {
    60             public void run() {
    61                 createAndShowGUI();
    61                 createAndShowGUI();
    62             }
    62             }
    63         });
    63         });
    64 
    64 
    65         toolkit.realSync();
    65         robot.waitForIdle();
    66         Thread.sleep(500);
    66         Thread.sleep(500);
    67 
    67 
    68         Point p1 = Util.getCenterPoint(button1);
    68         Point p1 = Util.getCenterPoint(button1);
    69         Point p2 = Util.getCenterPoint(button2);
    69         Point p2 = Util.getCenterPoint(button2);
    70 
    70