• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Util类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: performTest

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
@Override
protected boolean performTest() {
    // run robot
    Robot robot = Util.createRobot();
    robot.setAutoDelay(ROBOT_DELAY);

    try {
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                hLoc = scrollPane.getHorizontalScrollBar().getLocationOnScreen();
                vLoc = scrollPane.getVerticalScrollBar().getLocationOnScreen();
            }
        });
    } catch (Exception e) {
    }
    hLoc.translate(2, 2);
    vLoc.translate(2, 2);

    clickAndBlink(robot, hLoc, false);
    clickAndBlink(robot, vLoc, false);

    return horizontalClicked && verticalClicked;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:JScrollPaneOverlapping.java


示例2: performTest

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
@Override
protected boolean performTest() {
    try {
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                splitterLoc = sp2.getLocationOnScreen();
                Point leftLoc = sp1.getLocationOnScreen();
                leftLoc.translate(sp1.getWidth(), 0);
                splitterLoc.translate(-(splitterLoc.x - leftLoc.x) / 2, 30);
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException("Where is splitter?");
    }
    // run robot
    Robot robot = Util.createRobot();
    robot.setAutoDelay(ROBOT_DELAY);

    robot.mouseMove(splitterLoc.x, splitterLoc.y);
    Util.waitForIdle(robot);

    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseMove(splitterLoc.x - 50, splitterLoc.y);
    Color c = robot.getPixelColor(splitterLoc.x - 50, splitterLoc.y);
    System.out.println("Actual: "+c+", (not) expected: "+AWT_VERIFY_COLOR+" at "+(splitterLoc.x - 50)+", "+ splitterLoc.y);
    if (!ignoreFail && c.equals(AWT_VERIFY_COLOR)) {
        fail("The JSplitPane drag-n-drop image did not pass pixel color check and is overlapped");
    }
    robot.mouseRelease(InputEvent.BUTTON1_MASK);

    clickAndBlink(robot, splitterLoc);

    return clicked;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:JSplitPaneOverlapping.java


示例3: start

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public void start() {
    owner.setBounds(100, 100, 200, 100);
    window.setBounds(100, 250, 200, 100);
    frame.setBounds(350, 100, 200, 100);
    window.add(button);

    owner.setVisible(true);
    frame.setVisible(true);
    window.setVisible(true);

    Util.waitForIdle(robot);

    test();

    System.out.println("Test passed");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:OwnedWindowFocusIMECrashTest.java


示例4: main

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public static void main(String[] args) {
    PaintSetEnabledDeadlock frame = new PaintSetEnabledDeadlock();
    frame.setSize(200, 200);
    frame.setVisible(true);

    Robot robot = Util.createRobot();
    robot.setAutoDelay(100);
    robot.setAutoWaitForIdle(true);

    for (int i = 0; i < 20; ++i) {
        Util.clickOnComp(frame.panel, robot);
        Util.clickOnComp(frame.button, robot);
    }

    boolean ret = frame.panel.stop();
    frame.dispose();

    if (!ret) {
        throw new RuntimeException("Test failed!");
    }
    System.out.println("Test passed.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:PaintSetEnabledDeadlock.java


示例5: main

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    SwingUtilities.invokeAndWait(() -> {
        new RemovedComponentMouseListener();
    });

    Robot r = Util.createRobot();
    r.setAutoDelay(100);
    r.waitForIdle();
    Util.pointOnComp(button, r);

    r.waitForIdle();
    r.mousePress(InputEvent.BUTTON1_MASK);
    r.waitForIdle();
    r.mouseRelease(InputEvent.BUTTON1_MASK);
    r.waitForIdle();
    if (!mouseReleasedReceived) {
        throw new RuntimeException("mouseReleased event was not received");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:RemovedComponentMouseListener.java


示例6: startRegTest

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
private static Thread startRegTest(final Frame f) {
    Thread robot = new Thread(new Runnable() {
        public void run() {
            Robot r = Util.createRobot();
            dragWindow(f, 100, 100, r);
            // wait for the location to be set.
            sleepFor(2000);

            final Point l2 = f.getLocationOnScreen();

            // double click should maximize the frame
            doubleClick(r);

            // wait for location again.
            sleepFor(2000);
            final Point l3 = f.getLocationOnScreen();
            if (l3.equals(l2)) {
                throw new RuntimeException("Bad location after maximize. Window location has not moved");
            }
        }
    });
    return robot;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:MutterMaximizeTest.java


示例7: createObjects

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
void createObjects() {
    textArea = new TextArea( bigString() );
    robot = Util.createRobot();

    Panel panel = new Panel();
    panel.setLayout( new GridLayout(3,3) );

    for( int y=0; y<3; ++y ) {
        for( int x=0; x<3; ++x ) {
            if( x==1 && y==1 ) {
                panel.add( textArea );
            } else {
                panel.add( new Panel() );
            }
        }
    }

    Frame frame = new Frame( "TextArea cursor icon test" );
    frame.setSize( 300, 300 );
    frame.add( panel );
    frame.setVisible( true );
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:SelectionAutoscrollTest.java


示例8: test

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public void test() {
    if (!testFocused(textField)) {
        Util.clickOnComp(textField, robot);
        if (!testFocused(textField)) {
            throw new RuntimeException("Error: couldn't focus " + textField);
        }
    }

    robot.keyPress(KeyEvent.VK_TAB);
    robot.delay(50);
    robot.keyRelease(KeyEvent.VK_TAB);

    if (!testFocused(button3)) {
        throw new RuntimeException("Test failed: dialog didn't get focus!");
    }

    System.out.println("Test passed.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:JDK8013611.java


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


示例10: main

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public static void main(final String[] args) throws AWTException {
    final bug7097771 frame = new bug7097771();
    frame.setSize(300, 300);
    frame.setLocationRelativeTo(null);
    final Button button = new Button();
    button.addActionListener(frame);
    frame.add(button);
    frame.setVisible(true);
    Robot robot = new Robot();
    sleep(robot);
    frame.setEnabled(false);
    button.setEnabled(false);
    button.setEnabled(true);
    sleep(robot);
    Util.clickOnComp(button, robot);
    sleep(robot);
    frame.dispose();
    if (action) {
        throw new RuntimeException("Button is not disabled.");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:bug7097771.java


示例11: main

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
    Frame frame = new Frame("Frame Minimize Test");
    Button b = new Button("Focus ownder");
    frame.add("South", b);
    frame.pack();
    frame.setVisible(true);
    Util.waitForIdle(null);
    if (!b.hasFocus()) {
        throw new RuntimeException("button is not a focus owner after showing :(");
    }
    frame.setExtendedState(Frame.ICONIFIED);
    Util.waitForIdle(null);
    frame.setExtendedState(Frame.NORMAL);
    Util.waitForIdle(null);
    if (!b.hasFocus()) {
        throw new RuntimeException("button is not a focus owner after restoring :(");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:FrameMinimizeTest.java


示例12: testSetText

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
private void testSetText() {
    textField.setText(null);
    textField.requestFocus();
    Util.clickOnComp(textField, robot);
    Util.waitForIdle(robot);
    robot.keyPress(KeyEvent.VK_A);
    robot.delay(5);
    robot.keyRelease(KeyEvent.VK_A);
    Util.waitForIdle(robot);
    textField.setText(null);
    checkTest("");
    textField.setText("CaseSensitive");
    checkTest("CaseSensitive");
    textField.setText("caseSensitive");
    checkTest("caseSensitive");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TextFieldEditing.java


示例13: init

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
private static void init()
{
    String[] instructions =
    {
        "This is an AUTOMATIC test, simply wait until it is done.",
        "The result (passed or failed) will be shown in the",
        "message window below."
    };
    Sysout.createDialog( );
    Sysout.printInstructions( instructions );

    Frame f = new Frame();
    f.setSize(100, 100);
    f.setVisible(true);

    Robot robot = Util.createRobot();
    Util.waitForIdle(robot);

    Dimension size = SecurityWarning.getSize(f);
    if (size.width == 0 || size.height == 0) {
        fail("Reported security warning size: " + size);
        return;
    }
    pass();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:GetSizeShouldNotReturnZero.java


示例14: runTests

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
void runTests()
{
    Frame frame = new Frame("frame");
    frame.setBounds(100, 100, 100, 100);
    frame.setVisible(true);
    frame.validate();
    Util.waitTillShown(frame);

    Robot robot = Util.createRobot();
    robot.setAutoDelay(10);

    oneButtonPressRelease(frame, robot, false, 1);
    oneButtonPressRelease(frame, robot, true, 0);
    twoButtonPressRelease(frame, robot, false, 2);
    twoButtonPressRelease(frame, robot, true, 1);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:MouseClickTest.java


示例15: showFrame

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
void showFrame() {
    if (frame != null) {
        frame.dispose();
        Util.waitForIdle(robot);
    }
    frame = new TestFrame();
    frame.setVisible(true);
    Util.waitTillShown(frame);

    if (!frame.b0.hasFocus()) {
        Util.clickOnComp(frame.b0, robot);
        Util.waitForIdle(robot);
        if (!frame.b0.hasFocus()) {
            throw new TestErrorException("couldn't set focus on " + frame.b2);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:ContainerFocusAutoTransferTest.java


示例16: start

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public void start ()
{
    //Get things going.  Request focus, set size, et cetera
    setSize (200,200);
    setVisible(true);
    validate();

    //What would normally go into main() will probably go here.
    //Use System.out.println for diagnostic messages that you want
    //to read after the test is done.
    //Use Sysout.println for messages you want the tester to read.

        robot = Util.createRobot();
        robot.setAutoDelay(100);
        robot.mouseMove(BOUNDS.x + (BOUNDS.width / 2),
                        BOUNDS.y + (BOUNDS.height/ 2));

        frame = new Frame("TitleBarDoubleClick");
        frame.setBounds(BOUNDS);
        frame.addMouseListener(this);
        frame.addWindowListener(this);
        frame.setVisible(true);
        Util.waitForIdle(robot);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:TitleBarDoubleClick.java


示例17: start

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public void start() {
    if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.ICONIFIED) ||
        !Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.NORMAL))
    {
        System.out.println("Frame.ICONIFIED or Frame.NORMAL state is unsupported.");
        return;
    }

    frame.setSize(100, 100);

    frame.setVisible(true);

    Util.waitForIdle(robot);

    if (!frame.isFocused()) {
        Util.clickOnTitle(frame, robot);
        Util.waitForIdle(robot);
    }

    if (!frame.isFocused()) {
        throw new Error("Test error: couldn't focus the Frame.");
    }

    test();
    System.out.println("Test passed.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:DeiconifiedFrameLoosesFocus.java


示例18: main

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public static void main(String[] args) {
    frame = new TestFrame("Test EDT access to Window components");
    window = new TestWindow(frame);

    SwingUtilities.invokeLater(WindowIsFocusableAccessByThreadsTest::init);

    Util.waitTillShown(frame);
    Robot robot = Util.createRobot();
    Util.clickOnComp(frame, robot, 100);
    Util.clickOnComp(openWindowBtn, robot, 100);

    Util.waitTillShown(window);

    if (!testPassed.get()) {
        throw new RuntimeException("Window component methods has been accessed not " +
                "from Event Dispatching Thread");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:WindowIsFocusableAccessByThreadsTest.java


示例19: start

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public void start ()
{
    setSize (200,200);
    frame.setVisible(true);
    validate();
    Util.waitForIdle(robot);

    try {
        robot = new Robot();
        robot.setAutoWaitForIdle(true);
        mousePositionAbsolute = new Point(button.getLocationOnScreen().x + button.getWidth()/2,
                                          button.getLocationOnScreen().y + button.getHeight()/2);
        mousePosition = new Point(button.getWidth()/2,
                                  button.getHeight()/2);
        robot.mouseMove(mousePositionAbsolute.x,
                        mousePositionAbsolute.y );
        //            robot.delay(1000);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
    }catch(AWTException e) {
        throw new RuntimeException("Test Failed. AWTException thrown.");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:FrameMouseEventAbsoluteCoordsTest.java


示例20: main

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public static void main(String[] args) {
    final Frame f = new Frame("F");
    f.setBounds(0,0,200,200);
    f.setEnabled(false); // <- disable the top-level
    f.setVisible(true);

    Window w = new Window(f);
    w.setBounds(300,300,300,300);
    w.add(new TextField(20));
    w.setVisible(true);

    Robot robot = Util.createRobot();
    robot.setAutoDelay(1000);
    Util.waitForIdle(robot);
    robot.delay(1000);
    Util.clickOnTitle(f, robot);
    Util.waitForIdle(robot);

    f.dispose();
    System.out.println("Test passed!");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:bug7024749.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClassFileReader类代码示例发布时间:2022-05-21
下一篇:
Java VcsException类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap