Java Code Examples for java.awt.GraphicsDevice#isDisplayChangeSupported()

The following examples show how to use java.awt.GraphicsDevice#isDisplayChangeSupported() . 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: CheckDisplayModes.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
    if (!graphicDevice.isDisplayChangeSupported()) {
        System.err.println("Display mode change is not supported on this host. Test is considered passed.");
        return;
    }
    DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
    checkDisplayMode(defaultDisplayMode);
    graphicDevice.setDisplayMode(defaultDisplayMode);

    DisplayMode[] displayModes = graphicDevice.getDisplayModes();
    boolean isDefaultDisplayModeIncluded = false;
    for (DisplayMode displayMode : displayModes) {
        checkDisplayMode(displayMode);
        graphicDevice.setDisplayMode(displayMode);
        if (defaultDisplayMode.equals(displayMode)) {
            isDefaultDisplayModeIncluded = true;
        }
    }

    if (!isDefaultDisplayModeIncluded) {
        throw new RuntimeException("Default display mode is not included");
    }
}
 
Example 2
Source File: CheckDisplayModes.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
    if (!graphicDevice.isDisplayChangeSupported()) {
        System.err.println("Display mode change is not supported on this host. Test is considered passed.");
        return;
    }
    DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
    checkDisplayMode(defaultDisplayMode);
    graphicDevice.setDisplayMode(defaultDisplayMode);

    DisplayMode[] displayModes = graphicDevice.getDisplayModes();
    boolean isDefaultDisplayModeIncluded = false;
    for (DisplayMode displayMode : displayModes) {
        checkDisplayMode(displayMode);
        graphicDevice.setDisplayMode(displayMode);
        if (defaultDisplayMode.equals(displayMode)) {
            isDefaultDisplayModeIncluded = true;
        }
    }

    if (!isDefaultDisplayModeIncluded) {
        throw new RuntimeException("Default display mode is not included");
    }
}
 
Example 3
Source File: CheckDisplayModes.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    for (GraphicsDevice graphicDevice : ge.getScreenDevices()) {
        if (!graphicDevice.isDisplayChangeSupported()) {
            System.err.println("Display mode change is not supported on this host. Test is considered passed.");
            continue;
        }
        DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
        checkDisplayMode(defaultDisplayMode);
        graphicDevice.setDisplayMode(defaultDisplayMode);

        DisplayMode[] displayModes = graphicDevice.getDisplayModes();
        boolean isDefaultDisplayModeIncluded = false;
        for (DisplayMode displayMode : displayModes) {
            checkDisplayMode(displayMode);
            graphicDevice.setDisplayMode(displayMode);
            if (defaultDisplayMode.equals(displayMode)) {
                isDefaultDisplayModeIncluded = true;
            }
        }

        if (!isDefaultDisplayModeIncluded) {
            throw new RuntimeException("Default display mode is not included");
        }
    }
}
 
Example 4
Source File: CheckDisplayModes.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
    if (!graphicDevice.isDisplayChangeSupported()) {
        System.err.println("Display mode change is not supported on this host. Test is considered passed.");
        return;
    }
    DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
    checkDisplayMode(defaultDisplayMode);
    graphicDevice.setDisplayMode(defaultDisplayMode);

    DisplayMode[] displayModes = graphicDevice.getDisplayModes();
    boolean isDefaultDisplayModeIncluded = false;
    for (DisplayMode displayMode : displayModes) {
        checkDisplayMode(displayMode);
        graphicDevice.setDisplayMode(displayMode);
        if (defaultDisplayMode.equals(displayMode)) {
            isDefaultDisplayModeIncluded = true;
        }
    }

    if (!isDefaultDisplayModeIncluded) {
        throw new RuntimeException("Default display mode is not included");
    }
}
 
Example 5
Source File: CheckDisplayModes.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
    if (!graphicDevice.isDisplayChangeSupported()) {
        System.err.println("Display mode change is not supported on this host. Test is considered passed.");
        return;
    }
    DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
    checkDisplayMode(defaultDisplayMode);
    graphicDevice.setDisplayMode(defaultDisplayMode);

    DisplayMode[] displayModes = graphicDevice.getDisplayModes();
    boolean isDefaultDisplayModeIncluded = false;
    for (DisplayMode displayMode : displayModes) {
        checkDisplayMode(displayMode);
        graphicDevice.setDisplayMode(displayMode);
        if (defaultDisplayMode.equals(displayMode)) {
            isDefaultDisplayModeIncluded = true;
        }
    }

    if (!isDefaultDisplayModeIncluded) {
        throw new RuntimeException("Default display mode is not included");
    }
}
 
Example 6
Source File: CheckDisplayModes.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    for (GraphicsDevice graphicDevice : ge.getScreenDevices()) {
        if (!graphicDevice.isDisplayChangeSupported()) {
            System.err.println("Display mode change is not supported on this host. Test is considered passed.");
            continue;
        }
        DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
        checkDisplayMode(defaultDisplayMode);
        graphicDevice.setDisplayMode(defaultDisplayMode);

        DisplayMode[] displayModes = graphicDevice.getDisplayModes();
        boolean isDefaultDisplayModeIncluded = false;
        for (DisplayMode displayMode : displayModes) {
            checkDisplayMode(displayMode);
            graphicDevice.setDisplayMode(displayMode);
            if (defaultDisplayMode.equals(displayMode)) {
                isDefaultDisplayModeIncluded = true;
            }
        }

        if (!isDefaultDisplayModeIncluded) {
            throw new RuntimeException("Default display mode is not included");
        }
    }
}
 
Example 7
Source File: CheckDisplayModes.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
    if (!graphicDevice.isDisplayChangeSupported()) {
        System.err.println("Display mode change is not supported on this host. Test is considered passed.");
        return;
    }
    DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
    checkDisplayMode(defaultDisplayMode);
    graphicDevice.setDisplayMode(defaultDisplayMode);

    DisplayMode[] displayModes = graphicDevice.getDisplayModes();
    boolean isDefaultDisplayModeIncluded = false;
    for (DisplayMode displayMode : displayModes) {
        checkDisplayMode(displayMode);
        graphicDevice.setDisplayMode(displayMode);
        if (defaultDisplayMode.equals(displayMode)) {
            isDefaultDisplayModeIncluded = true;
        }
    }

    if (!isDefaultDisplayModeIncluded) {
        throw new RuntimeException("Default display mode is not included");
    }
}
 
Example 8
Source File: CheckDisplayModes.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
    if (!graphicDevice.isDisplayChangeSupported()) {
        System.err.println("Display mode change is not supported on this host. Test is considered passed.");
        return;
    }
    DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
    checkDisplayMode(defaultDisplayMode);
    graphicDevice.setDisplayMode(defaultDisplayMode);

    DisplayMode[] displayModes = graphicDevice.getDisplayModes();
    boolean isDefaultDisplayModeIncluded = false;
    for (DisplayMode displayMode : displayModes) {
        checkDisplayMode(displayMode);
        graphicDevice.setDisplayMode(displayMode);
        if (defaultDisplayMode.equals(displayMode)) {
            isDefaultDisplayModeIncluded = true;
        }
    }

    if (!isDefaultDisplayModeIncluded) {
        throw new RuntimeException("Default display mode is not included");
    }
}
 
Example 9
Source File: CheckDisplayModes.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    for (GraphicsDevice graphicDevice : ge.getScreenDevices()) {
        if (!graphicDevice.isDisplayChangeSupported()) {
            System.err.println("Display mode change is not supported on this host. Test is considered passed.");
            continue;
        }
        DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
        checkDisplayMode(defaultDisplayMode);
        graphicDevice.setDisplayMode(defaultDisplayMode);

        DisplayMode[] displayModes = graphicDevice.getDisplayModes();
        boolean isDefaultDisplayModeIncluded = false;
        for (DisplayMode displayMode : displayModes) {
            checkDisplayMode(displayMode);
            graphicDevice.setDisplayMode(displayMode);
            if (defaultDisplayMode.equals(displayMode)) {
                isDefaultDisplayModeIncluded = true;
            }
        }

        if (!isDefaultDisplayModeIncluded) {
            throw new RuntimeException("Default display mode is not included");
        }
    }
}
 
Example 10
Source File: CheckDisplayModes.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
    if (!graphicDevice.isDisplayChangeSupported()) {
        System.err.println("Display mode change is not supported on this host. Test is considered passed.");
        return;
    }
    DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
    checkDisplayMode(defaultDisplayMode);
    graphicDevice.setDisplayMode(defaultDisplayMode);

    DisplayMode[] displayModes = graphicDevice.getDisplayModes();
    boolean isDefaultDisplayModeIncluded = false;
    for (DisplayMode displayMode : displayModes) {
        checkDisplayMode(displayMode);
        graphicDevice.setDisplayMode(displayMode);
        if (defaultDisplayMode.equals(displayMode)) {
            isDefaultDisplayModeIncluded = true;
        }
    }

    if (!isDefaultDisplayModeIncluded) {
        throw new RuntimeException("Default display mode is not included");
    }
}
 
Example 11
Source File: CheckDisplayModes.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
    if (!graphicDevice.isDisplayChangeSupported()) {
        System.err.println("Display mode change is not supported on this host. Test is considered passed.");
        return;
    }
    DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
    checkDisplayMode(defaultDisplayMode);
    graphicDevice.setDisplayMode(defaultDisplayMode);

    DisplayMode[] displayModes = graphicDevice.getDisplayModes();
    boolean isDefaultDisplayModeIncluded = false;
    for (DisplayMode displayMode : displayModes) {
        checkDisplayMode(displayMode);
        graphicDevice.setDisplayMode(displayMode);
        if (defaultDisplayMode.equals(displayMode)) {
            isDefaultDisplayModeIncluded = true;
        }
    }

    if (!isDefaultDisplayModeIncluded) {
        throw new RuntimeException("Default display mode is not included");
    }
}
 
Example 12
Source File: DisplayChangeVITest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void run() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (gd.isDisplayChangeSupported() && dms.size() > 0) {
        while (!done && reps++ < TEST_REPS) {
            for (DisplayMode dm : dms) {
                System.err.printf("Entering DisplayMode[%dx%dx%d]\n",
                    dm.getWidth(), dm.getHeight(), dm.getBitDepth());
                gd.setDisplayMode(dm);

                initBackbuffer();
                for (int i = 0; i < 10; i++) {
                    // render to the screen
                    render(getGraphics());
                    // ask Swing to repaint
                    repaint();
                    sleep(100);
                }
                sleep(1500);
            }
        }
    } else {
        System.err.println("Display mode change " +
                           "not supported. Test passed.");
    }
    dispose();
    synchronized (lock) {
        done = true;
        lock.notify();
    }
}
 
Example 13
Source File: DisplayChangeVITest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void run() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (gd.isDisplayChangeSupported() && dms.size() > 0) {
        while (!done && reps++ < TEST_REPS) {
            for (DisplayMode dm : dms) {
                System.err.printf("Entering DisplayMode[%dx%dx%d]\n",
                    dm.getWidth(), dm.getHeight(), dm.getBitDepth());
                gd.setDisplayMode(dm);

                initBackbuffer();
                for (int i = 0; i < 10; i++) {
                    // render to the screen
                    render(getGraphics());
                    // ask Swing to repaint
                    repaint();
                    sleep(100);
                }
                sleep(1500);
            }
        }
    } else {
        System.err.println("Display mode change " +
                           "not supported. Test passed.");
    }
    dispose();
    synchronized (lock) {
        done = true;
        lock.notify();
    }
}
 
Example 14
Source File: DisplayChangeVITest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void run() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (gd.isDisplayChangeSupported() && dms.size() > 0) {
        while (!done && reps++ < TEST_REPS) {
            for (DisplayMode dm : dms) {
                System.err.printf("Entering DisplayMode[%dx%dx%d]\n",
                    dm.getWidth(), dm.getHeight(), dm.getBitDepth());
                gd.setDisplayMode(dm);

                initBackbuffer();
                for (int i = 0; i < 10; i++) {
                    // render to the screen
                    render(getGraphics());
                    // ask Swing to repaint
                    repaint();
                    sleep(100);
                }
                sleep(1500);
            }
        }
    } else {
        System.err.println("Display mode change " +
                           "not supported. Test passed.");
    }
    dispose();
    synchronized (lock) {
        done = true;
        lock.notify();
    }
}
 
Example 15
Source File: DisplayChangeVITest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void run() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (gd.isDisplayChangeSupported() && dms.size() > 0) {
        while (!done && reps++ < TEST_REPS) {
            for (DisplayMode dm : dms) {
                System.err.printf("Entering DisplayMode[%dx%dx%d]\n",
                    dm.getWidth(), dm.getHeight(), dm.getBitDepth());
                gd.setDisplayMode(dm);

                initBackbuffer();
                for (int i = 0; i < 10; i++) {
                    // render to the screen
                    render(getGraphics());
                    // ask Swing to repaint
                    repaint();
                    sleep(100);
                }
                sleep(1500);
            }
        }
    } else {
        System.err.println("Display mode change " +
                           "not supported. Test passed.");
    }
    dispose();
    synchronized (lock) {
        done = true;
        lock.notify();
    }
}
 
Example 16
Source File: DisplayChangeVITest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void run() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (gd.isDisplayChangeSupported() && dms.size() > 0) {
        while (!done && reps++ < TEST_REPS) {
            for (DisplayMode dm : dms) {
                System.err.printf("Entering DisplayMode[%dx%dx%d]\n",
                    dm.getWidth(), dm.getHeight(), dm.getBitDepth());
                gd.setDisplayMode(dm);

                initBackbuffer();
                for (int i = 0; i < 10; i++) {
                    // render to the screen
                    render(getGraphics());
                    // ask Swing to repaint
                    repaint();
                    sleep(100);
                }
                sleep(1500);
            }
        }
    } else {
        System.err.println("Display mode change " +
                           "not supported. Test passed.");
    }
    dispose();
    synchronized (lock) {
        done = true;
        lock.notify();
    }
}
 
Example 17
Source File: DisplayChangeVITest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void run() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (gd.isDisplayChangeSupported() && dms.size() > 0) {
        while (!done && reps++ < TEST_REPS) {
            for (DisplayMode dm : dms) {
                System.err.printf("Entering DisplayMode[%dx%dx%d]\n",
                    dm.getWidth(), dm.getHeight(), dm.getBitDepth());
                gd.setDisplayMode(dm);

                initBackbuffer();
                for (int i = 0; i < 10; i++) {
                    // render to the screen
                    render(getGraphics());
                    // ask Swing to repaint
                    repaint();
                    sleep(100);
                }
                sleep(1500);
            }
        }
    } else {
        System.err.println("Display mode change " +
                           "not supported. Test passed.");
    }
    dispose();
    synchronized (lock) {
        done = true;
        lock.notify();
    }
}
 
Example 18
Source File: DisplayChangeVITest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void run() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (gd.isDisplayChangeSupported() && dms.size() > 0) {
        while (!done && reps++ < TEST_REPS) {
            for (DisplayMode dm : dms) {
                System.err.printf("Entering DisplayMode[%dx%dx%d]\n",
                    dm.getWidth(), dm.getHeight(), dm.getBitDepth());
                gd.setDisplayMode(dm);

                initBackbuffer();
                for (int i = 0; i < 10; i++) {
                    // render to the screen
                    render(getGraphics());
                    // ask Swing to repaint
                    repaint();
                    sleep(100);
                }
                sleep(1500);
            }
        }
    } else {
        System.err.println("Display mode change " +
                           "not supported. Test passed.");
    }
    dispose();
    synchronized (lock) {
        done = true;
        lock.notify();
    }
}
 
Example 19
Source File: DisplayChangeVITest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void run() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (gd.isDisplayChangeSupported() && dms.size() > 0) {
        while (!done && reps++ < TEST_REPS) {
            for (DisplayMode dm : dms) {
                System.err.printf("Entering DisplayMode[%dx%dx%d]\n",
                    dm.getWidth(), dm.getHeight(), dm.getBitDepth());
                gd.setDisplayMode(dm);

                initBackbuffer();
                for (int i = 0; i < 10; i++) {
                    // render to the screen
                    render(getGraphics());
                    // ask Swing to repaint
                    repaint();
                    sleep(100);
                }
                sleep(1500);
            }
        }
    } else {
        System.err.println("Display mode change " +
                           "not supported. Test passed.");
    }
    dispose();
    synchronized (lock) {
        done = true;
        lock.notify();
    }
}
 
Example 20
Source File: DisplayChangeVITest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void run() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (gd.isDisplayChangeSupported() && dms.size() > 0) {
        while (!done && reps++ < TEST_REPS) {
            for (DisplayMode dm : dms) {
                System.err.printf("Entering DisplayMode[%dx%dx%d]\n",
                    dm.getWidth(), dm.getHeight(), dm.getBitDepth());
                gd.setDisplayMode(dm);

                initBackbuffer();
                for (int i = 0; i < 10; i++) {
                    // render to the screen
                    render(getGraphics());
                    // ask Swing to repaint
                    repaint();
                    sleep(100);
                }
                sleep(1500);
            }
        }
    } else {
        System.err.println("Display mode change " +
                           "not supported. Test passed.");
    }
    dispose();
    synchronized (lock) {
        done = true;
        lock.notify();
    }
}