< prev index next >

test/java/awt/EventQueue/6980209/bug6980209.java

Print this page

        

*** 27,36 **** --- 27,37 ---- @author Semyon Sadetsky */ import javax.swing.*; import java.awt.*; + import java.awt.event.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.logging.Logger;
*** 45,54 **** --- 46,57 ---- private static JFrame frame; private static int disorderCounter = 0; private static Boolean enterReturn; private static Boolean exitReturn; private static int dispatchedEvents; + private static JButton button; + private static Point point; public static void main(String[] args) throws Exception { System.out.println( "PLEASE DO NOT TOUCH KEYBOARD AND MOUSE DURING THE TEST RUN!"); // log.setLevel(java.util.logging.Level.FINE);
*** 60,69 **** --- 63,89 ---- frame.setUndecorated(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setup(frame); } }); + final Robot robot = new Robot(); + robot.delay(100); + robot.waitForIdle(); + robot.setAutoDelay(10); + robot.setAutoWaitForIdle(true); + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + point = button.getLocationOnScreen(); + } + }); + robot.mouseMove( point.x + 5, point.y + 5 ); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.delay(100); + robot.waitForIdle(); + testExitBeforeEnter(); System.out.println("Run random test in EDT"); runInEDT = true; testRandomly(); System.out.println("Run random test in another thread");
*** 100,109 **** --- 120,130 ---- } private static void testRandomly() throws AWTException { disorderCounter = 0; final Robot robot = new Robot(); + robot.setAutoDelay(1); for (int i = 0; i < ATTEMPTS; i++) { enterReturn = null; exitReturn = null; dispatchedEvents = 0; synchronized (bug6980209.class) {
*** 154,171 **** ATTEMPTS); } } private static void setup(final JFrame frame) { ! JButton jButton = new JButton("Button"); ! frame.getContentPane().add(jButton); ! jButton.addActionListener(new bug6980209()); frame.pack(); frame.setVisible(true); ! jButton.setFocusable(true); ! jButton.requestFocus(); ! jButton.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override --- 175,192 ---- ATTEMPTS); } } private static void setup(final JFrame frame) { ! button = new JButton("Button"); ! frame.getContentPane().add(button); ! button.addActionListener(new bug6980209()); frame.pack(); frame.setVisible(true); ! button.setFocusable(true); ! button.requestFocus(); ! button.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override
< prev index next >