sun.awt.OSInfo.OSType Java Examples

The following examples show how to use sun.awt.OSInfo.OSType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: bug8046391.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example #2
Source File: bug8046391.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example #3
Source File: bug8046391.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example #4
Source File: bug8046391.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example #5
Source File: bug8046391.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example #6
Source File: bug8046391.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example #7
Source File: bug8046391.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example #8
Source File: bug8046391.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example #9
Source File: bug8046391.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example #10
Source File: bug8046391.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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
}
 
Example #11
Source File: UITest.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #12
Source File: UITest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #13
Source File: bug8024061.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
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();
    }
}
 
Example #14
Source File: bug8024061.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
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();
    }
}
 
Example #15
Source File: UITest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #16
Source File: UITest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #17
Source File: bug8024061.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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();
    }
}
 
Example #18
Source File: UITest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #19
Source File: bug8024061.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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();
    }
}
 
Example #20
Source File: bug8024061.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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();
    }
}
 
Example #21
Source File: UITest.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #22
Source File: UITest.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #23
Source File: UITest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #24
Source File: bug8024061.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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();
    }
}
 
Example #25
Source File: UITest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #26
Source File: UITest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #27
Source File: bug8024061.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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();
    }
}
 
Example #28
Source File: UITest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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!");
            }
    }

}
 
Example #29
Source File: bug8024061.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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();
    }
}
 
Example #30
Source File: bug8024061.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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();
    }
}