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


Java Util.waitTillShown方法代码示例

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


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

示例1: start

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void start() {
    frame.setVisible(true);
    Util.waitTillShown(frame);

    Point loc = frame.getLocationOnScreen();
    robot.mouseMove(loc.x + frame.getWidth() / 4, loc.y + frame.getInsets().top / 2);
    robot.delay(50);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.delay(50);
    robot.mouseMove(loc.x + 100, loc.y + 50);
    robot.delay(50);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);

    Util.waitForIdle(robot);

    loc = frame.getLocation();
    robot.mouseMove(loc.x + frame.getWidth() / 2, loc.y + frame.getHeight() / 2);
    Util.waitForIdle(robot);

    if (!(frame.getLocation().equals(loc))) {
        throw new RuntimeException("Test failed: frame is moving to mouse with grab!");
    }
    System.out.println("Test passed.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:FrameJumpingToMouse.java

示例2: test1

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
void test1(Window owner, Window child) {
    System.out.println("* * * STAGE 1 * * *\nWindow owner: " + owner);

    owner.setFocusableWindowState(false);
    owner.setVisible(true);

    child.add(button);
    child.setVisible(true);

    Util.waitTillShown(child);

    Util.clickOnComp(button, robot);
    if (button == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
        throw new RuntimeException("Test Failed.");
    }
    child.dispose();
    owner.dispose();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:NonfocusableOwnerTest.java

示例3: test2

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
void test2(Window owner, Window child1, Window child2) {
    System.out.println("* * * STAGE 2 * * *\nWindow nowner: " + owner);

    owner.setFocusableWindowState(false);
    owner.setVisible(true);

    child1.setFocusableWindowState(true);
    child1.setVisible(true);

    child2.add(button);
    child2.setVisible(true);

    Util.waitTillShown(child2);

    Util.clickOnComp(button, robot);
    if (button == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
        throw new RuntimeException("Test failed.");
    }
    child2.dispose();
    child1.dispose();
    owner.dispose();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:NonfocusableOwnerTest.java

示例4: test3

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
void test3(Window owner, Window child1, Window child2) {
    System.out.println("* * * STAGE 3 * * *\nWidow owner: " + owner);

    owner.setFocusableWindowState(true);
    owner.setVisible(true);

    child1.setFocusableWindowState(false);
    child1.setVisible(true);

    child2.setFocusableWindowState(true);
    child2.add(button);
    child2.setVisible(true);

    Util.waitTillShown(child2);

    Util.clickOnComp(button, robot);
    System.err.println("focus owner: " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
    if (button != KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
        throw new RuntimeException("Test failed.");
    }
    child1.dispose();
    child2.dispose();
    owner.dispose();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:NonfocusableOwnerTest.java

示例5: 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

示例6: 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

示例7: 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

示例8: test

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void test() {
    Button[] butArr = new Button[] {testButton3, testButton2, testButton1};
    Window[] winArr = new Window[] {window2, window1, owner};

    step = 1;
    for (int i = 0; i < 3; i++) {
        clickInSeriesCheckFocus(null, butArr[i], frame);
        clickOwnerCheckFocus(winArr[i], butArr[i]);
        step++;
    }

    step = 4;
    clickInSeriesCheckFocus(testButton3, testButton1, frame);
    clickOwnerCheckFocus(owner, testButton1);

    step = 5;
    clickInSeriesCheckFocus(testButton3, testButton2, frame);
    clickOwnerCheckFocus(window1, testButton2);

    step = 6;
    clickInSeriesCheckFocus(testButton1, testButton2, frame);
    clickOwnerCheckFocus(window1, testButton2);

    step = 7;
    clickInSeriesCheckFocus(testButton1, testButton2, frame);
    window1.setVisible(false);
    Util.waitForIdle(robot);
    clickOwnerCheckFocus(owner, testButton1);

    step = 8;
    window1.setVisible(true);
    Util.waitTillShown(window1);
    clickInSeriesCheckFocus(null, testButton2, frame);
    clickOwnerCheckFocus(window1, testButton2);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:36,代码来源:ActualFocusedWindowRetaining.java

示例9: start

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void start() {
    frame.setVisible(true);
    Util.waitTillShown(frame);

    // Show the dialog.
    robot.keyPress(KeyEvent.VK_TAB);
    robot.delay(50);
    robot.keyRelease(KeyEvent.VK_TAB);

    Util.waitForIdle(robot);

    // Dispose the dialog.
    Runnable action = new Runnable() {
        public void run() {
            dialog.dispose();
        }
    };
    if (!Util.trackFocusGained(tf1, action, 2000, false)) {
        throw new RuntimeException("Test failed: TAB was processed incorrectly!");
    }

    // Check for type-ability.
    robot.keyPress(KeyEvent.VK_A);
    robot.delay(50);
    robot.keyRelease(KeyEvent.VK_A);

    Util.waitForIdle(robot);

    if (tf1.getText().equals("")) {
        throw new RuntimeException("Test failed: couldn't type a char!");
    }
    System.out.println("Test passed.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:ConsumeNextKeyTypedOnModalShowTest.java

示例10: init

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void init() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            frame = new JFrame();
            frame.setLayout(new FlowLayout());
            button = new WeakReference<JButton>(new JButton("Text"));
            p = new WeakReference<JPanel>(new JPanel(new FlowLayout()));
            p.get().add(button.get());
            frame.add(p.get());

            frame.setBounds(500, 400, 200, 200);
            frame.setVisible(true);
        }
    });

    Util.waitTillShown(button.get());
    Util.clickOnComp(button.get(), new Robot());

    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            frame.remove(p.get());
        }
    });

    Util.waitForIdle(null);
    assertGC();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:LWDispatcherMemoryLeakTest.java

示例11: testComponent

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private void testComponent(Component component) throws InterruptedException, InvocationTargetException {
    Robot robot = null;
    try {
        robot = new Robot();
    }catch(Exception ignorex) {
    }
    currentAwtControl = component;
    System.out.println("Testing " + currentAwtControl.getClass().getSimpleName());
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            prepareControls();
        }
    });
    if (component != null) {
        Util.waitTillShown(component);
    }
    Util.waitForIdle(robot);
    try {
        Thread.sleep(500); // wait for graphic effects on systems like Win7
    } catch (InterruptedException ex) {
    }
    if (!instance.performTest()) {
        fail(failMessage);
        passed = false;
    }
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            cleanup();
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:OverlappingTestBase.java

示例12: start

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void start() {
    if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
        Sysout.println("The test is not for MToolkit.");
        return;
    }

    dialog.setBounds(800, 0, 200, 100);
    frame.setBounds(800, 150, 200, 100);

    dialog.addWindowFocusListener(new WindowAdapter() {
            public void windowLostFocus(WindowEvent e) {
                Sysout.println(e.toString());
                synchronized (lostFocus) {
                    lostFocus.set(true);
                    lostFocus.notifyAll();
                }
            }
        });

    new Thread(new Runnable() {
            public void run() {
                dialog.setVisible(true);
            }
        }).start();

    Util.waitTillShown(dialog);
    toolkit.realSync();

    // Test 1. Show a modal blocked frame, check that it doesn't steal focus.

    frame.setVisible(true);

    if (Util.waitForCondition(lostFocus, 2000L)) {
        throw new TestFailedException("the modal blocked frame stole focus on its showing!");
    }

    // Test 2. Brought a modal blocked frame to front, check that it doesn't steal focus.

    frame.toFront();

    if (Util.waitForCondition(lostFocus, 2000L)) {
        throw new TestFailedException("the modal blocked frame stole focus on its bringing to front!");
    } else {
        Sysout.println("Test passed");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:47,代码来源:ModalBlockedStealsFocusTest.java

示例13: start

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void start () {
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
            public void eventDispatched(AWTEvent e) {
                Object src = e.getSource();
                Class cls = src.getClass();

                if (cls == TestWindow.class) {
                    System.out.println(e.paramString() + " on <" + (src == window1 ? "Window 1" : "Window 2") + ">");
                } else if (cls == Frame.class) {
                    System.out.println(e.paramString() + " on <" + ((Frame)src).getTitle() + ">");
                } else if (cls == Button.class) {
                    System.out.println(e.paramString() + " on <" + ((Button)src).getLabel() + ">");
                } else {
                    System.out.println(e.paramString() + " on <Non-testing component>");
                }
            }
        }, AWTEvent.WINDOW_EVENT_MASK | AWTEvent.WINDOW_FOCUS_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK);

    setSize (500, 200);
    setVisible(true);
    validate();

    frame.setSize(new Dimension(400, 100));
    frame.setLocation(800, 400);
    frame.setVisible(true);
    frame.toFront();

    owner.setLayout(new FlowLayout());
    owner.add(testButton1);
    owner.add(otherButton1);
    owner.pack();
    owner.setLocation(800, 100);
    owner.setSize(new Dimension(400, 100));
    owner.setVisible(true);
    owner.toFront();
    Util.waitTillShown(owner);

    window1.setVisible(true);
    window2.setVisible(true);
    window1.toFront();
    window2.toFront();
    // Wait longer...
    Util.waitTillShown(window1);
    Util.waitTillShown(window2);

    test();

    frame.dispose();
    owner.dispose();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:51,代码来源:ActualFocusedWindowRetaining.java

示例14: start

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void start() {
    if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
        Sysout.println("The test is not for MToolkit.");
        return;
    }

    dialog.setBounds(800, 0, 200, 100);
    frame.setBounds(800, 150, 200, 100);

    dialog.addWindowFocusListener(new WindowAdapter() {
            public void windowLostFocus(WindowEvent e) {
                Sysout.println(e.toString());
                synchronized (lostFocus) {
                    lostFocus.set(true);
                    lostFocus.notifyAll();
                }
            }
        });

    new Thread(new Runnable() {
            public void run() {
                dialog.setVisible(true);
            }
        }).start();

    Util.waitTillShown(dialog);
    try {
        Robot robot = new Robot();
        robot.waitForIdle();
    }catch(Exception ex) {
        ex.printStackTrace();
        throw new RuntimeException("Unexpected failure");
    }

    // Test 1. Show a modal blocked frame, check that it doesn't steal focus.

    frame.setVisible(true);

    if (Util.waitForCondition(lostFocus, 2000L)) {
        throw new TestFailedException("the modal blocked frame stole focus on its showing!");
    }

    // Test 2. Brought a modal blocked frame to front, check that it doesn't steal focus.

    frame.toFront();

    if (Util.waitForCondition(lostFocus, 2000L)) {
        throw new TestFailedException("the modal blocked frame stole focus on its bringing to front!");
    } else {
        Sysout.println("Test passed");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:53,代码来源:ModalBlockedStealsFocusTest.java


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