本文整理汇总了Java中test.java.awt.regtesthelpers.Util.mouseMove方法的典型用法代码示例。如果您正苦于以下问题:Java Util.mouseMove方法的具体用法?Java Util.mouseMove怎么用?Java Util.mouseMove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test.java.awt.regtesthelpers.Util
的用法示例。
在下文中一共展示了Util.mouseMove方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {
try {
final Robot r = new Robot();
r.setAutoDelay(50);
r.mouseMove(100, 100);
Util.waitForIdle(r);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
initAndShowUI();
}
});
final Point inside = new Point(frame.getLocationOnScreen());
inside.translate(20, SIZE / 2);
final Point outer = new Point(inside);
outer.translate(-40, 0);
r.mouseMove(inside.x, inside.y);
r.mousePress(InputEvent.BUTTON1_MASK);
try {
for (int i = 0; i < 3; ++i) {
Util.mouseMove(r, inside, outer);
Util.mouseMove(r, outer, inside);
}
} finally {
r.mouseRelease(InputEvent.BUTTON1_MASK);
}
sleep();
if (FAILED || !MOUSE_ENTERED || !MOUSE_ENTERED_DT || !MOUSE_EXIT
|| !MOUSE_EXIT_TD) {
throw new RuntimeException("Failed");
}
} finally {
if (frame != null) {
frame.dispose();
}
}
}
示例2: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {
try {
final Robot r = new Robot();
r.setAutoDelay(50);
r.mouseMove(100, 100);
Util.waitForIdle(r);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
initAndShowUI();
}
});
final Point inside = new Point(frame.getLocationOnScreen());
inside.translate(20, SIZE / 2);
final Point outer = new Point(inside);
outer.translate(-40, 0);
r.mouseMove(inside.x, inside.y);
r.mousePress(InputEvent.BUTTON1_MASK);
try {
for (int i = 0; i < 3; ++i) {
Util.mouseMove(r, inside, outer);
Util.mouseMove(r, outer, inside);
}
} finally {
r.mouseRelease(InputEvent.BUTTON1_MASK);
}
sleep(r);
if (FAILED || !MOUSE_ENTERED || !MOUSE_ENTERED_DT || !MOUSE_EXIT
|| !MOUSE_EXIT_TD) {
throw new RuntimeException("Failed");
}
} finally {
if (frame != null) {
frame.dispose();
}
}
}
示例3: moveBetween
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private static void moveBetween(Robot r, Point first, Point second) {
Util.waitForIdle(r);
Util.mouseMove(r, first, second);
Util.waitForIdle(r);
Util.mouseMove(r, second, first);
Util.waitForIdle(r);
}
示例4: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String []s) {
Frame frame = new SensibleFrame();
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Robot robot = Util.createRobot();
Util.waitForIdle(robot);
/* The defect may appear on every kind of mouse event: movement, press, etc.
* so start mouse move from frame's outside. Use small threshhold depending on the
* frame's size.
*/
Point start = new Point(frame.getLocationOnScreen().x - frame.getWidth()/5,
frame.getLocationOnScreen().y - frame.getHeight()/5);
Point end = new Point(frame.getLocationOnScreen().x + frame.getWidth() * 6 / 5,
frame.getLocationOnScreen().y + frame.getHeight() * 6 / 5);
Sysout.println("start = " + start);
Sysout.println("end = " + end);
Util.mouseMove(robot, start, end);
// Start drag inside toplevel.
start = new Point(frame.getLocationOnScreen().x + frame.getWidth()/2,
frame.getLocationOnScreen().y + frame.getHeight()/2);
end = new Point(frame.getLocationOnScreen().x + frame.getWidth() * 6 / 5,
frame.getLocationOnScreen().y + frame.getHeight() * 6 / 5);
Util.drag(robot, start, end, MouseEvent.BUTTON1_MASK);
}
示例5: test
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private static boolean test() {
// Test events for HeavyComponent
Point loc = HeavyComponent.getLocationOnScreen();
Dimension size = HeavyComponent.getSize();
Util.mouseMove(testRobot,
new Point((int) loc.x + 4, (int) loc.y + 4),
new Point((int) loc.x + size.width, (int) loc.y + size.height));
testRobot.waitForIdle();
boolean HeavyComponentAssert = HeavyComponent.assertEvents(2, 1);
// Test events for LightComponent
loc = LightComponent.getLocationOnScreen();
size = LightComponent.getSize();
Util.mouseMove(testRobot,
new Point((int) loc.x + 4, (int) loc.y + 4),
new Point((int) loc.x + size.width, (int) loc.y + size.height));
testRobot.waitForIdle();
boolean LightComponentAssert = LightComponent.assertEvents(2, 1);
return (HeavyComponentAssert && LightComponentAssert);
}
示例6: testMouseMoveOutside
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private void testMouseMoveOutside() {
waitForIdle();
Point pt = choice1.getLocationOnScreen();
robot.mouseMove(pt.x + choice1.getWidth() / 2, pt.y + choice1.getHeight() / 2);
waitForIdle();
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
waitForIdle();
Color color = robot.getPixelColor(pt.x + choice1.getWidth() / 2,
pt.y + 3 * choice1.getHeight());
if (!color.equals(Color.RED)) {
throw new RuntimeException("Choice wasn't opened with LEFTMOUSE button");
}
pt = getLocationOnScreen();
robot.mouseMove(pt.x + getWidth() * 2, pt.y + getHeight() * 2);
mmh.testStarted = true;
int x0 = pt.x + getWidth() * 3 / 2;
int y0 = pt.y + getHeight() * 3 / 2;
int x1 = pt.x + getWidth() * 2;
int y1 = pt.y + getHeight() * 2;
Util.mouseMove(robot, new Point(x0, y0), new Point(x1, y0));
Util.mouseMove(robot, new Point(x1, y0), new Point(x1, y1));
waitForIdle();
//close opened choice
robot.keyPress(KeyEvent.VK_ESCAPE);
robot.keyRelease(KeyEvent.VK_ESCAPE);
}
示例7: moveMouseToCenterOfTextArea
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
void moveMouseToCenterOfTextArea() {
Dimension d = textArea.getSize();
Point l = textArea.getLocationOnScreen();
Util.mouseMove(robot, l, new Point((int) (l.x + d.width * .5),
(int) (l.y + d.height * .5)));
}