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

下面列出了怎么用sun.awt.OSInfo.OSType的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_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
}
 
源代码2 项目: TencentKona-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
}
 
源代码3 项目: jdk8u60   文件: 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
}
 
源代码4 项目: openjdk-jdk8u   文件: 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
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: 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
}
 
源代码6 项目: 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
}
 
源代码7 项目: hottub   文件: 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
}
 
源代码8 项目: 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
}
 
源代码9 项目: 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
}
 
源代码10 项目: 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
}
 
源代码11 项目: dragonwell8_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();
    }
}
 
源代码12 项目: dragonwell8_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!");
            }
    }

}
 
源代码13 项目: TencentKona-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();
    }
}
 
源代码14 项目: TencentKona-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!");
            }
    }

}
 
源代码15 项目: jdk8u60   文件: 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();
    }
}
 
源代码16 项目: jdk8u60   文件: 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!");
            }
    }

}
 
源代码17 项目: openjdk-jdk8u   文件: 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();
    }
}
 
源代码18 项目: openjdk-jdk8u   文件: 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!");
            }
    }

}
 
源代码19 项目: openjdk-jdk8u-backup   文件: 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();
    }
}
 
源代码20 项目: openjdk-jdk8u-backup   文件: 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!");
            }
    }

}
 
源代码21 项目: 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();
    }
}
 
源代码22 项目: 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!");
            }
    }

}
 
源代码23 项目: hottub   文件: 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();
    }
}
 
源代码24 项目: hottub   文件: 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!");
            }
    }

}
 
源代码25 项目: openjdk-8-source   文件: 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!");
            }
    }

}
 
源代码26 项目: openjdk-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!");
            }
    }

}
 
源代码27 项目: 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();
    }
}
 
源代码28 项目: 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!");
            }
    }

}
 
源代码29 项目: 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();
    }
}
 
源代码30 项目: 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!");
            }
    }

}
 
 类所在包
 类方法
 同包方法