< prev index next >

test/java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java

Print this page

        

@@ -44,15 +44,12 @@
     private int[][] pointsToCheck;
 
     private static Robot robot;
 
     public ShapeNotSetSometimes() throws Exception {
-        EventQueue.invokeAndWait(new Runnable() {
-            public void run() {
-                initializeGUI();
-            }
-        });
+        EventQueue.invokeAndWait(this::initializeGUI);
+        robot.waitForIdle();
     }
 
     private void initializeGUI() {
         backgroundFrame = new BackgroundFrame();
         backgroundFrame.setUndecorated(true);

@@ -117,11 +114,11 @@
     }
 
     public static void main(String[] args) throws Exception {
         robot = new Robot();
 
-        for(int i = 0; i < 100; i++) {
+        for(int i = 0; i < 50; i++) {
             System.out.println("Attempt " + i);
             new ShapeNotSetSometimes().doTest();
         }
     }
 

@@ -132,15 +129,11 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(10);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
 
-        EventQueue.invokeAndWait(new Runnable() {
-            public void run() {
-                window.requestFocus();
-            }
-        });
+        EventQueue.invokeAndWait(window::requestFocus);
 
         robot.waitForIdle();
         try {
             Thread.sleep(300);
         } catch (InterruptedException e) {
< prev index next >