Java 类sun.awt.OSInfo.OSType 实例源码

项目:jdk8u-jdk    文件:bug8046391.java   
public static void main(String[] args) throws Exception {
    OSType type = OSInfo.getOSType();
    if (type != OSType.WINDOWS) {
        System.out.println("This test is for Windows only... skipping!");
        return;
    }

    SwingUtilities.invokeAndWait(() -> {
        try {
            UIManager.setLookAndFeel(new WindowsLookAndFeel());
        } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
        }
        System.out.println("Creating JFileChooser...");
        JFileChooser fileChooser = new JFileChooser();
        System.out.println("Test passed: chooser = " + fileChooser);
    });
    // Test fails if creating JFileChooser hangs
}
项目:jdk8u_jdk    文件:bug8046391.java   
public static void main(String[] args) throws Exception {
    OSType type = OSInfo.getOSType();
    if (type != OSType.WINDOWS) {
        System.out.println("This test is for Windows only... skipping!");
        return;
    }

    SwingUtilities.invokeAndWait(() -> {
        try {
            UIManager.setLookAndFeel(new WindowsLookAndFeel());
        } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
        }
        System.out.println("Creating JFileChooser...");
        JFileChooser fileChooser = new JFileChooser();
        System.out.println("Test passed: chooser = " + fileChooser);
    });
    // Test fails if creating JFileChooser hangs
}
项目:lookaside_java-1.8.0-openjdk    文件:bug8046391.java   
public static void main(String[] args) throws Exception {
    OSType type = OSInfo.getOSType();
    if (type != OSType.WINDOWS) {
        System.out.println("This test is for Windows only... skipping!");
        return;
    }

    SwingUtilities.invokeAndWait(() -> {
        try {
            UIManager.setLookAndFeel(new WindowsLookAndFeel());
        } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
        }
        System.out.println("Creating JFileChooser...");
        JFileChooser fileChooser = new JFileChooser();
        System.out.println("Test passed: chooser = " + fileChooser);
    });
    // Test fails if creating JFileChooser hangs
}
项目:infobip-open-jdk-8    文件:bug8046391.java   
public static void main(String[] args) throws Exception {
    OSType type = OSInfo.getOSType();
    if (type != OSType.WINDOWS) {
        System.out.println("This test is for Windows only... skipping!");
        return;
    }

    SwingUtilities.invokeAndWait(() -> {
        try {
            UIManager.setLookAndFeel(new WindowsLookAndFeel());
        } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
        }
        System.out.println("Creating JFileChooser...");
        JFileChooser fileChooser = new JFileChooser();
        System.out.println("Test passed: chooser = " + fileChooser);
    });
    // Test fails if creating JFileChooser hangs
}
项目:jdk8u-dev-jdk    文件:bug8046391.java   
public static void main(String[] args) throws Exception {
    OSType type = OSInfo.getOSType();
    if (type != OSType.WINDOWS) {
        System.out.println("This test is for Windows only... skipping!");
        return;
    }

    SwingUtilities.invokeAndWait(() -> {
        try {
            UIManager.setLookAndFeel(new WindowsLookAndFeel());
        } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
        }
        System.out.println("Creating JFileChooser...");
        JFileChooser fileChooser = new JFileChooser();
        System.out.println("Test passed: chooser = " + fileChooser);
    });
    // Test fails if creating JFileChooser hangs
}
项目:jdk8u-jdk    文件:bug8024061.java   
public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException {
    OSType type = OSInfo.getOSType();
    if (type != OSType.LINUX && type != OSType.SOLARIS) {
        System.out.println("This test is for Linux and Solaris only... " +
                           "skipping!");
        return;
    }

    final bug8024061[] dnd = {null};
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            dnd[0] = new bug8024061();
        }
    });
    final Robot robot = new Robot();
    robot.setAutoDelay(10);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    JFrame frame = dnd[0].frame;
    Point point = frame.getLocationOnScreen();
    Point here = new Point(point.x + 35, point.y + 45);
    Point there = new Point(point.x + 120, point.y + 45);
    here.x += 25;
    robot.mouseMove(here.x, here.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    while (here.x < there.x) {
        here.x += 20;
        robot.mouseMove(here.x, here.y);
        System.out.println("x = " + here.x);
    }
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    toolkit.realSync();
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    System.out.println("finished");

    try {
        if (lock.await(5, TimeUnit.SECONDS)) {
            if (dragEnterException == null) {
                System.out.println("Test passed.");
            } else {
                System.out.println("Test failed.");
                dragEnterException.printStackTrace();
                throw new RuntimeException(dragEnterException);
            }
        } else {
            System.out.println("Test failed. Timeout reached");
            throw new RuntimeException("Timed out waiting for dragEnter()");
        }
    } finally {
        frame.dispose();
    }
}
项目:jdk8u-jdk    文件:UITest.java   
public static void main(String[] args) {
    OSType os = OSInfo.getOSType();
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();

    switch (os) {
        case WINDOWS:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On windows, but GTK is present");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On windows, but Aqua is present");
            }

            // Make sure we have Windows.
            if (!hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On windows and don't have Windows");
            }

            break;

        case MACOSX:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On mac, but GTK is present");
            }

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On mac, but Windows is present");
            }

            // Make sure we have Aqua.
            if (!hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On mac and don't have Aqua");
            }

            break;

        default:
            // Not windows and mac

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("Not on windows and have Windows");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("Not on mac and have Aqua");
            }

            // Make sure we have GTK.
            if (!hasLAF("gtk", lafInfo)) {
                throw new RuntimeException(
                        "Not on Windows and Mac and don't have GTK!");
            }
    }

}
项目:jdk8u_jdk    文件:bug8024061.java   
public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException {
    OSType type = OSInfo.getOSType();
    if (type != OSType.LINUX && type != OSType.SOLARIS) {
        System.out.println("This test is for Linux and Solaris only... " +
                           "skipping!");
        return;
    }

    final bug8024061[] dnd = {null};
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            dnd[0] = new bug8024061();
        }
    });
    final Robot robot = new Robot();
    robot.setAutoDelay(10);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    JFrame frame = dnd[0].frame;
    Point point = frame.getLocationOnScreen();
    Point here = new Point(point.x + 35, point.y + 45);
    Point there = new Point(point.x + 120, point.y + 45);
    here.x += 25;
    robot.mouseMove(here.x, here.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    while (here.x < there.x) {
        here.x += 20;
        robot.mouseMove(here.x, here.y);
        System.out.println("x = " + here.x);
    }
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    toolkit.realSync();
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    System.out.println("finished");

    try {
        if (lock.await(5, TimeUnit.SECONDS)) {
            if (dragEnterException == null) {
                System.out.println("Test passed.");
            } else {
                System.out.println("Test failed.");
                dragEnterException.printStackTrace();
                throw new RuntimeException(dragEnterException);
            }
        } else {
            System.out.println("Test failed. Timeout reached");
            throw new RuntimeException("Timed out waiting for dragEnter()");
        }
    } finally {
        frame.dispose();
    }
}
项目:jdk8u_jdk    文件:UITest.java   
public static void main(String[] args) {
    OSType os = OSInfo.getOSType();
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();

    switch (os) {
        case WINDOWS:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On windows, but GTK is present");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On windows, but Aqua is present");
            }

            // Make sure we have Windows.
            if (!hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On windows and don't have Windows");
            }

            break;

        case MACOSX:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On mac, but GTK is present");
            }

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On mac, but Windows is present");
            }

            // Make sure we have Aqua.
            if (!hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On mac and don't have Aqua");
            }

            break;

        default:
            // Not windows and mac

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("Not on windows and have Windows");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("Not on mac and have Aqua");
            }

            // Make sure we have GTK.
            if (!hasLAF("gtk", lafInfo)) {
                throw new RuntimeException(
                        "Not on Windows and Mac and don't have GTK!");
            }
    }

}
项目:lookaside_java-1.8.0-openjdk    文件:bug8024061.java   
public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException {
    OSType type = OSInfo.getOSType();
    if (type != OSType.LINUX && type != OSType.SOLARIS) {
        System.out.println("This test is for Linux and Solaris only... " +
                           "skipping!");
        return;
    }

    final bug8024061[] dnd = {null};
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            dnd[0] = new bug8024061();
        }
    });
    final Robot robot = new Robot();
    robot.setAutoDelay(10);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    JFrame frame = dnd[0].frame;
    Point point = frame.getLocationOnScreen();
    Point here = new Point(point.x + 35, point.y + 45);
    Point there = new Point(point.x + 120, point.y + 45);
    here.x += 25;
    robot.mouseMove(here.x, here.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    while (here.x < there.x) {
        here.x += 20;
        robot.mouseMove(here.x, here.y);
        System.out.println("x = " + here.x);
    }
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    toolkit.realSync();
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    System.out.println("finished");

    try {
        if (lock.await(5, TimeUnit.SECONDS)) {
            if (dragEnterException == null) {
                System.out.println("Test passed.");
            } else {
                System.out.println("Test failed.");
                dragEnterException.printStackTrace();
                throw new RuntimeException(dragEnterException);
            }
        } else {
            System.out.println("Test failed. Timeout reached");
            throw new RuntimeException("Timed out waiting for dragEnter()");
        }
    } finally {
        frame.dispose();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:UITest.java   
public static void main(String[] args) {
    OSType os = OSInfo.getOSType();
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();

    switch (os) {
        case WINDOWS:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On windows, but GTK is present");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On windows, but Aqua is present");
            }

            // Make sure we have Windows.
            if (!hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On windows and don't have Windows");
            }

            break;

        case MACOSX:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On mac, but GTK is present");
            }

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On mac, but Windows is present");
            }

            // Make sure we have Aqua.
            if (!hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On mac and don't have Aqua");
            }

            break;

        default:
            // Not windows and mac

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("Not on windows and have Windows");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("Not on mac and have Aqua");
            }

            // Make sure we have GTK.
            if (!hasLAF("gtk", lafInfo)) {
                throw new RuntimeException(
                        "Not on Windows and Mac and don't have GTK!");
            }
    }

}
项目:infobip-open-jdk-8    文件:bug8024061.java   
public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException {
    OSType type = OSInfo.getOSType();
    if (type != OSType.LINUX && type != OSType.SOLARIS) {
        System.out.println("This test is for Linux and Solaris only... " +
                           "skipping!");
        return;
    }

    final bug8024061[] dnd = {null};
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            dnd[0] = new bug8024061();
        }
    });
    final Robot robot = new Robot();
    robot.setAutoDelay(10);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    JFrame frame = dnd[0].frame;
    Point point = frame.getLocationOnScreen();
    Point here = new Point(point.x + 35, point.y + 45);
    Point there = new Point(point.x + 120, point.y + 45);
    here.x += 25;
    robot.mouseMove(here.x, here.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    while (here.x < there.x) {
        here.x += 20;
        robot.mouseMove(here.x, here.y);
        System.out.println("x = " + here.x);
    }
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    toolkit.realSync();
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    System.out.println("finished");

    try {
        if (lock.await(5, TimeUnit.SECONDS)) {
            if (dragEnterException == null) {
                System.out.println("Test passed.");
            } else {
                System.out.println("Test failed.");
                dragEnterException.printStackTrace();
                throw new RuntimeException(dragEnterException);
            }
        } else {
            System.out.println("Test failed. Timeout reached");
            throw new RuntimeException("Timed out waiting for dragEnter()");
        }
    } finally {
        frame.dispose();
    }
}
项目:infobip-open-jdk-8    文件:UITest.java   
public static void main(String[] args) {
    OSType os = OSInfo.getOSType();
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();

    switch (os) {
        case WINDOWS:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On windows, but GTK is present");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On windows, but Aqua is present");
            }

            // Make sure we have Windows.
            if (!hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On windows and don't have Windows");
            }

            break;

        case MACOSX:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On mac, but GTK is present");
            }

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On mac, but Windows is present");
            }

            // Make sure we have Aqua.
            if (!hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On mac and don't have Aqua");
            }

            break;

        default:
            // Not windows and mac

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("Not on windows and have Windows");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("Not on mac and have Aqua");
            }

            // Make sure we have GTK.
            if (!hasLAF("gtk", lafInfo)) {
                throw new RuntimeException(
                        "Not on Windows and Mac and don't have GTK!");
            }
    }

}
项目:jdk8u-dev-jdk    文件:bug8024061.java   
public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException {
    OSType type = OSInfo.getOSType();
    if (type != OSType.LINUX && type != OSType.SOLARIS) {
        System.out.println("This test is for Linux and Solaris only... " +
                           "skipping!");
        return;
    }

    final bug8024061[] dnd = {null};
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            dnd[0] = new bug8024061();
        }
    });
    final Robot robot = new Robot();
    robot.setAutoDelay(10);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    JFrame frame = dnd[0].frame;
    Point point = frame.getLocationOnScreen();
    Point here = new Point(point.x + 35, point.y + 45);
    Point there = new Point(point.x + 120, point.y + 45);
    here.x += 25;
    robot.mouseMove(here.x, here.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    while (here.x < there.x) {
        here.x += 20;
        robot.mouseMove(here.x, here.y);
        System.out.println("x = " + here.x);
    }
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    toolkit.realSync();
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    System.out.println("finished");

    try {
        if (lock.await(5, TimeUnit.SECONDS)) {
            if (dragEnterException == null) {
                System.out.println("Test passed.");
            } else {
                System.out.println("Test failed.");
                dragEnterException.printStackTrace();
                throw new RuntimeException(dragEnterException);
            }
        } else {
            System.out.println("Test failed. Timeout reached");
            throw new RuntimeException("Timed out waiting for dragEnter()");
        }
    } finally {
        frame.dispose();
    }
}
项目:jdk8u-dev-jdk    文件:UITest.java   
public static void main(String[] args) {
    OSType os = OSInfo.getOSType();
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();

    switch (os) {
        case WINDOWS:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On windows, but GTK is present");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On windows, but Aqua is present");
            }

            // Make sure we have Windows.
            if (!hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On windows and don't have Windows");
            }

            break;

        case MACOSX:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On mac, but GTK is present");
            }

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On mac, but Windows is present");
            }

            // Make sure we have Aqua.
            if (!hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On mac and don't have Aqua");
            }

            break;

        default:
            // Not windows and mac

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("Not on windows and have Windows");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("Not on mac and have Aqua");
            }

            // Make sure we have GTK.
            if (!hasLAF("gtk", lafInfo)) {
                throw new RuntimeException(
                        "Not on Windows and Mac and don't have GTK!");
            }
    }

}
项目:OLD-OpenJDK8    文件:UITest.java   
public static void main(String[] args) {
    OSType os = OSInfo.getOSType();
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();

    switch (os) {
        case WINDOWS:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On windows, but GTK is present");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On windows, but Aqua is present");
            }

            // Make sure we have Windows.
            if (!hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On windows and don't have Windows");
            }

            break;

        case MACOSX:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On mac, but GTK is present");
            }

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On mac, but Windows is present");
            }

            // Make sure we have Aqua.
            if (!hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On mac and don't have Aqua");
            }

            break;

        default:
            // Not windows and mac

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("Not on windows and have Windows");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("Not on mac and have Aqua");
            }

            // Make sure we have GTK.
            if (!hasLAF("gtk", lafInfo)) {
                throw new RuntimeException(
                        "Not on Windows and Mac and don't have GTK!");
            }
    }

}
项目:openjdk-jdk7u-jdk    文件:bug8024061.java   
public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException {
    OSType type = OSInfo.getOSType();
    if (type != OSType.LINUX && type != OSType.SOLARIS) {
        System.out.println("This test is for Linux and Solaris only... " +
                           "skipping!");
        return;
    }

    final bug8024061[] dnd = {null};
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            dnd[0] = new bug8024061();
        }
    });
    final Robot robot = new Robot();
    robot.setAutoDelay(10);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.realSync();

    JFrame frame = dnd[0].frame;
    Point point = frame.getLocationOnScreen();
    Point here = new Point(point.x + 35, point.y + 45);
    Point there = new Point(point.x + 120, point.y + 45);
    here.x += 25;
    robot.mouseMove(here.x, here.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    while (here.x < there.x) {
        here.x += 20;
        robot.mouseMove(here.x, here.y);
        System.out.println("x = " + here.x);
    }
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    toolkit.realSync();
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    System.out.println("finished");

    try {
        if (lock.await(5, TimeUnit.SECONDS)) {
            if (dragEnterException == null) {
                System.out.println("Test passed.");
            } else {
                System.out.println("Test failed.");
                dragEnterException.printStackTrace();
                throw new RuntimeException(dragEnterException);
            }
        } else {
            System.out.println("Test failed. Timeout reached");
            throw new RuntimeException("Timed out waiting for dragEnter()");
        }
    } finally {
        frame.dispose();
    }
}
项目:openjdk-jdk7u-jdk    文件:UITest.java   
public static void main(String[] args) {
    OSType os = OSInfo.getOSType();
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();

    switch (os) {
        case WINDOWS:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On windows, but GTK is present");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On windows, but Aqua is present");
            }

            // Make sure we have Windows.
            if (!hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On windows and don't have Windows");
            }

            break;

        case MACOSX:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On mac, but GTK is present");
            }

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On mac, but Windows is present");
            }

            // Make sure we have Aqua.
            if (!hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On mac and don't have Aqua");
            }

            break;

        default:
            // Not windows and mac

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("Not on windows and have Windows");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("Not on mac and have Aqua");
            }

            // Make sure we have GTK.
            if (!hasLAF("gtk", lafInfo)) {
                throw new RuntimeException(
                        "Not on Windows and Mac and don't have GTK!");
            }
    }

}
项目:openjdk-icedtea7    文件:UITest.java   
public static void main(String[] args) {
    OSType os = OSInfo.getOSType();
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();

    switch (os) {
        case WINDOWS:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On windows, but GTK is present");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On windows, but Aqua is present");
            }

            // Make sure we have Windows.
            if (!hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On windows and don't have Windows");
            }

            break;

        case MACOSX:

            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On mac, but GTK is present");
            }

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On mac, but Windows is present");
            }

            // Make sure we have Aqua.
            if (!hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On mac and don't have Aqua");
            }

            break;

        default:
            // Not windows and mac

            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("Not on windows and have Windows");
            }

            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("Not on mac and have Aqua");
            }

            // Make sure we have GTK.
            if (!hasLAF("gtk", lafInfo)) {
                throw new RuntimeException(
                        "Not on Windows and Mac and don't have GTK!");
            }
    }

}