jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java
changeset 28071 3acb75b8df45
parent 20149 1e892154c081
child 40128 e635645d2a8a
equal deleted inserted replaced
28070:001f640e7016 28071:3acb75b8df45
    30 import java.awt.*;
    30 import java.awt.*;
    31 import java.awt.event.*;
    31 import java.awt.event.*;
    32 import java.util.ArrayList;
    32 import java.util.ArrayList;
    33 import javax.swing.*;
    33 import javax.swing.*;
    34 import javax.swing.event.*;
    34 import javax.swing.event.*;
    35 import sun.awt.SunToolkit;
       
    36 
    35 
    37 public class bug4171437 {
    36 public class bug4171437 {
    38     static volatile boolean closeActivated = false;
    37     static volatile boolean closeActivated = false;
    39     static volatile boolean customActivated = false;
    38     static volatile boolean customActivated = false;
    40 
    39 
    43             public void run() {
    42             public void run() {
    44                 createAndShowGUI();
    43                 createAndShowGUI();
    45             }
    44             }
    46         });
    45         });
    47 
    46 
    48         SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
       
    49         toolkit.realSync();
       
    50 
       
    51         Robot robot = new Robot();
    47         Robot robot = new Robot();
    52         robot.setAutoDelay(50);
    48         robot.setAutoDelay(50);
       
    49         robot.waitForIdle();
    53 
    50 
    54         Util.hitMnemonics(robot, KeyEvent.VK_F);
    51         Util.hitMnemonics(robot, KeyEvent.VK_F);
    55         Util.hitKeys(robot, KeyEvent.VK_C);
    52         Util.hitKeys(robot, KeyEvent.VK_C);
    56 
    53 
    57         toolkit.realSync();
    54         robot.waitForIdle();
    58         Thread.sleep(1000);
    55         Thread.sleep(1000);
    59 
    56 
    60         if (!closeActivated || customActivated) {
    57         if (!closeActivated || customActivated) {
    61             throw new RuntimeException("Didn't pass the muster");
    58             throw new RuntimeException("Didn't pass the muster");
    62         }
    59         }