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


Java Util.drag方法代码示例

本文整理汇总了Java中test.java.awt.regtesthelpers.Util.drag方法的典型用法代码示例。如果您正苦于以下问题:Java Util.drag方法的具体用法?Java Util.drag怎么用?Java Util.drag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test.java.awt.regtesthelpers.Util的用法示例。


在下文中一共展示了Util.drag方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTest

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private void doTest(Point dragSourcePoint, TargetPanel targetPanel) {
    Util.waitForIdle(null);

    final Robot robot = Util.createRobot();

    robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
    try {
        sleep(100);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        sleep(100);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        sleep(100);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    Util.drag(robot, dragSourcePoint, new Point (AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(targetPanel),
            AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(targetPanel)),
            InputEvent.BUTTON1_MASK);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:DragUnicodeBetweenJVMTest.java

示例2: DragInterceptorAppletTest

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public DragInterceptorAppletTest(Point targetFrameLocation, Point dragSourcePoint)
        throws InterruptedException
{
    DragInterceptorFrame targetFrame = new DragInterceptorFrame(targetFrameLocation);

    Util.waitForIdle(null);

    final Robot robot = Util.createRobot();

    robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
    sleep(100);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    sleep(100);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    sleep(100);

    Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(),
            InputEvent.BUTTON1_MASK);

    sleep(2000);
    ProcessCommunicator.destroyProcess();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:DragInterceptorAppletTest.java

示例3: URIListBetweenJVMsTest

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public URIListBetweenJVMsTest (Point targetFrameLocation, Point dragSourcePoint,
        int transferredFilesNumber)
        throws InterruptedException
{
    TargetFileListFrame targetFrame = new TargetFileListFrame(targetFrameLocation,
            transferredFilesNumber);

    Util.waitForIdle(null);

    final Robot robot = Util.createRobot();

    robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
    sleep(100);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    sleep(100);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    sleep(100);

    Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(),
            InputEvent.BUTTON1_MASK);

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:URIListBetweenJVMsTest.java

示例4: FileListBetweenJVMsTest

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public FileListBetweenJVMsTest (Point targetFrameLocation, Point dragSourcePoint,
        int transferredFilesNumber)
        throws InterruptedException
{
    TargetFileListFrame targetFrame = new TargetFileListFrame(targetFrameLocation,
            transferredFilesNumber);

    Util.waitForIdle(null);

    final Robot robot = Util.createRobot();

    robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
    sleep(100);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    sleep(100);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    sleep(100);

    Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(),
            InputEvent.BUTTON1_MASK);

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:FileListBetweenJVMsTest.java

示例5: main

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) throws Throwable {
    try {

        SwingUtilities.invokeAndWait(() -> initAndShowUI());

        Robot r = new Robot();
        Util.waitForIdle(r);
        Util.drag(r,
                new Point(FRAME_LOCATION + FRAME_SIZE / 3, FRAME_LOCATION + FRAME_SIZE / 3),
                new Point(FRAME_LOCATION + FRAME_SIZE / 3 * 2, FRAME_LOCATION + FRAME_SIZE / 3 * 2),
                InputEvent.BUTTON1_MASK);
        Util.waitForIdle(r);
    } finally {
        if (f != null) {
            f.dispose();
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:AcceptDropMultipleTimes.java

示例6: main

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) throws Throwable {

        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                constructTestUI();
            }
        });

        Util.waitForIdle(null);
        try {
            Point loc = textArea.getLocationOnScreen();
            Util.drag(new Robot(),
                    new Point((int) loc.x + 3, (int) loc.y + 3),
                    new Point((int) loc.x + 40, (int) loc.y + 40),
                    InputEvent.BUTTON1_MASK);
        } catch (AWTException ex) {
            throw new RuntimeException("Could not initiate a drag operation");
        }
        Util.waitForIdle(null);
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:DisposeFrameOnDragTest.java

示例7: URIListToFileListBetweenJVMsTest

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public URIListToFileListBetweenJVMsTest(Point targetFrameLocation,
                                        Point dragSourcePoint,
                                        int transferredFilesNumber) throws InterruptedException
{
    TargetFileListFrame targetFrame = new TargetFileListFrame(targetFrameLocation, transferredFilesNumber);

    Util.waitForIdle(null);

    final Robot robot = Util.createRobot();

    robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
    sleep(100);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    sleep(100);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    sleep(100);

    Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(), InputEvent.BUTTON1_MASK);

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:URIListToFileListBetweenJVMsTest.java

示例8: doTest

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private void doTest(Point dragSourcePoint, TargetPanel targetPanel) {
    Util.waitForIdle(null);

    final Robot robot = Util.createRobot();

    robot.mouseMove((int) dragSourcePoint.getX(), (int) dragSourcePoint.getY());
    try {
        sleep(100);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        sleep(100);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        sleep(100);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    Util.drag(robot, dragSourcePoint, new Point(AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(targetPanel),
            AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(targetPanel)),
            InputEvent.BUTTON1_MASK);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:MissedHtmlAndRtfBug.java

示例9: main

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) throws Throwable {
    try {

        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                initAndShowUI();
            }
        });

        Robot r = new Robot();
        Util.waitForIdle(r);
        Util.drag(r,
                new Point(FRAME_LOCATION + FRAME_SIZE / 3, FRAME_LOCATION + FRAME_SIZE / 3),
                new Point(FRAME_LOCATION + FRAME_SIZE / 3 * 2, FRAME_LOCATION + FRAME_SIZE / 3 * 2),
                InputEvent.BUTTON1_MASK);
        Util.waitForIdle(r);

        if (!dragExitCalled) {
            throw new RuntimeException("Failed. Drag exit was not called" );
        }
    } finally {
        if (f != null) {
            f.dispose();
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:MissedDragExitTest.java

示例10: main

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) throws Throwable {
    try {

        SwingUtilities.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                initAndShowUI();
            }
        });

        Robot r = new Robot();
        Util.waitForIdle(r);
        Point leftCorner = new Point(mainPanel.getLocationOnScreen());
        leftCorner.translate(5, 5);
        Point rightCorner = new Point(mainPanel.getLocationOnScreen());
        rightCorner.translate(mainPanel.getWidth(), mainPanel.getHeight());
        rightCorner.translate(-5, -5);
        Util.drag(r, leftCorner, rightCorner, InputEvent.BUTTON1_MASK);
        Util.waitForIdle(r);

        int called = dragEnterCalled.get();
        if (called != 1) {
            throw new RuntimeException("Failed. Drag enter called " + called + " times. Expected 1" );
        }
    } finally {
        if (f != null) {
            f.dispose();
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:31,代码来源:ExtraDragEnterTest.java

示例11: 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:EventTimeInFuture.java

示例12: main

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static final void main(String args[])
{
    final Frame frame = new Frame();
    final List list = new List();
    Robot robot = null;

    for (int i = 0; i < 5; i++){
        list.add("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
    }

    frame.add(list);

    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);


    try{
        robot = new Robot();
    }catch(AWTException e){
        throw new RuntimeException(e);
    }
    robot.waitForIdle();

    //Drag from center to the outside on left
    Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2,
                           list.getLocationOnScreen().y + list.getHeight()/2);
    Point to = new Point(list.getLocationOnScreen().x - 30,
                         from.y);

    robot.waitForIdle();
    Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);

    robot.waitForIdle();

    //Drag from center to the outside on up
    to = new Point(from.x,
                   list.getLocationOnScreen().y - 50);

    robot.waitForIdle();
    Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:44,代码来源:ScrollOut.java

示例13: main

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static final void main(String args[])
{
    final Frame frame = new Frame();
    final List list = new List();
    Robot robot = null;

    for (int i = 0; i < 5; i++){
        list.add("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
    }

    frame.add(list);

    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();

    try{
        robot = new Robot();
    }catch(AWTException e){
        throw new RuntimeException(e);
    }

    //Drag from center to the outside on left
    Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2,
                           list.getLocationOnScreen().y + list.getHeight()/2);
    Point to = new Point(list.getLocationOnScreen().x - 30,
                         from.y);

    ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
    Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);

    ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();

    //Drag from center to the outside on up
    to = new Point(from.x,
                   list.getLocationOnScreen().y - 50);

    ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
    Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:44,代码来源:ScrollOut.java


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