当前位置: 首页>>代码示例>>Java>>正文


Java Util.mouseMove方法代码示例

本文整理汇总了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();
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:41,代码来源:MissingDragExitEventTest.java

示例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();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:41,代码来源:MissingDragExitEventTest.java

示例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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:SpuriousExitEnter_3.java

示例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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:30,代码来源:EventTimeInFuture.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:LightweightEventTest.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:PopdownGeneratesMouseEvents.java

示例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)));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:SelectionAutoscrollTest.java


注:本文中的test.java.awt.regtesthelpers.Util.mouseMove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。