< prev index next >
test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -31,36 +31,35 @@
* grid layout and check the components are re-laid out.
* The strategy followed is to calculate the component location
* depending on the preferred sizes and gaps and click the cornors
* of the components to check if events are triggered
* @library ../../../../lib/testlibrary/
- * @build ExtendedRobot
* @run main ChangeGridSize
* @run main ChangeGridSize -hg 20 -vg 20
*/
public class ChangeGridSize {
- private int width = 200;
+ private int width = 300;
private int height = 200;
private final int hGap, vGap;
private final int rows = 3;
private final int columns = 2;
private final int componentCount = 6;
private Button[] buttons;
private Frame frame;
- private ExtendedRobot robot;
+ private Robot robot;
private GridLayout layout;
private volatile boolean actionPerformed = false;
public ChangeGridSize(int hGap, int vGap) throws Exception {
this.hGap = hGap;
this.vGap = vGap;
- robot = new ExtendedRobot();
+ robot = new Robot();
EventQueue.invokeAndWait( () -> {
frame = new Frame("Test frame");
frame.setSize(width, height);
layout = new GridLayout(rows + 3, columns - 1, hGap, vGap);
frame.setLayout(layout);
@@ -120,22 +119,22 @@
robot.mouseMove(topLeftX, topLeftY);
robot.delay(500);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(500);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
- robot.waitForIdle(3000);
+ robot.delay(3000);
if(!actionPerformed)
throw new RuntimeException("Clicking on the left top of button did not trigger action event");
actionPerformed = false;
robot.mouseMove(bottomRightX, bottomRightY);
robot.delay(500);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(500);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
- robot.waitForIdle(3000);
+ robot.delay(3000);
if(!actionPerformed)
throw new RuntimeException("Clicking on the bottom right of button did not trigger action event");
}
< prev index next >