Java Code Examples for java.awt.Frame#setBackground()

The following examples show how to use java.awt.Frame#setBackground() . 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: ModalDialogOrderingTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {

        final Frame frame = new Frame("Test");
        frame.setSize(400, 400);
        frame.setBackground(FRAME_COLOR);
        frame.setVisible(true);

        final Dialog modalDialog = new Dialog(null, true);
        modalDialog.setTitle("Modal Dialog");
        modalDialog.setSize(400, 200);
        modalDialog.setBackground(DIALOG_COLOR);
        modalDialog.setModal(true);

        new Thread(new Runnable() {

            @Override
            public void run() {
                runTest(modalDialog, frame);
            }
        }).start();

        modalDialog.setVisible(true);
    }
 
Example 2
Source File: ModalDialogOrderingTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {

        final Frame frame = new Frame("Test");
        frame.setSize(400, 400);
        frame.setBackground(FRAME_COLOR);
        frame.setVisible(true);

        final Dialog modalDialog = new Dialog(null, true);
        modalDialog.setTitle("Modal Dialog");
        modalDialog.setSize(400, 200);
        modalDialog.setBackground(DIALOG_COLOR);
        modalDialog.setModal(true);

        new Thread(new Runnable() {

            @Override
            public void run() {
                runTest(modalDialog, frame);
            }
        }).start();

        modalDialog.setVisible(true);
    }
 
Example 3
Source File: ModalDialogOrderingTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {

        final Frame frame = new Frame("Test");
        frame.setSize(400, 400);
        frame.setBackground(FRAME_COLOR);
        frame.setVisible(true);

        final Dialog modalDialog = new Dialog(null, true);
        modalDialog.setTitle("Modal Dialog");
        modalDialog.setSize(400, 200);
        modalDialog.setBackground(DIALOG_COLOR);
        modalDialog.setModal(true);

        new Thread(new Runnable() {

            @Override
            public void run() {
                runTest(modalDialog, frame);
            }
        }).start();

        modalDialog.setVisible(true);
    }
 
Example 4
Source File: ModalDialogOrderingTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {

        final Frame frame = new Frame("Test");
        frame.setSize(400, 400);
        frame.setBackground(FRAME_COLOR);
        frame.setVisible(true);

        final Dialog modalDialog = new Dialog(null, true);
        modalDialog.setTitle("Modal Dialog");
        modalDialog.setSize(400, 200);
        modalDialog.setBackground(DIALOG_COLOR);
        modalDialog.setModal(true);

        new Thread(new Runnable() {

            @Override
            public void run() {
                runTest(modalDialog, frame);
            }
        }).start();

        modalDialog.setVisible(true);
    }
 
Example 5
Source File: DialogAboveFrameTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    Robot robot = Util.createRobot();

    Frame frame = new Frame("Frame");
    frame.setBackground(Color.BLUE);
    frame.setBounds(200, 50, 300, 300);
    frame.setVisible(true);

    Dialog dialog1 = new Dialog(frame, "Dialog 1", false);
    dialog1.setBackground(Color.RED);
    dialog1.setBounds(100, 100, 200, 200);
    dialog1.setVisible(true);

    Dialog dialog2 = new Dialog(frame, "Dialog 2", false);
    dialog2.setBackground(Color.GREEN);
    dialog2.setBounds(400, 100, 200, 200);
    dialog2.setVisible(true);

    Util.waitForIdle(robot);

    Util.clickOnComp(dialog2, robot);
    Util.waitForIdle(robot);

    Point point = dialog1.getLocationOnScreen();
    int x = point.x + (int)(dialog1.getWidth() * 0.9);
    int y = point.y + (int)(dialog1.getHeight() * 0.9);

    try {
        if (!Util.testPixelColor(x, y, dialog1.getBackground(), 10, 100, robot)) {
            throw new RuntimeException("Test FAILED: Dialog is behind the frame");
        }
    } finally {
        frame.dispose();
        dialog1.dispose();
        dialog2.dispose();
    }
}
 
Example 6
Source File: PaintNativeOnUpdate.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(final String[] args) throws AWTException {
    final Frame frame = new Frame();
    final Component label = new PaintNativeOnUpdate();
    frame.setBackground(Color.RED);
    frame.add(label);
    frame.setSize(300, 300);
    frame.setUndecorated(true);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    label.repaint();// first paint
    sleep();
    label.repaint();// incremental paint
    sleep();

    Robot robot = new Robot();
    robot.setAutoDelay(50);
    Point point = label.getLocationOnScreen();
    Color color = robot.getPixelColor(point.x + label.getWidth() / 2,
                                      point.y + label.getHeight() / 2);
    if (!color.equals(Color.GREEN)) {
        System.err.println("Expected color = " + Color.GREEN);
        System.err.println("Actual color = " + color);
        throw new RuntimeException();
    }
    frame.dispose();
}
 
Example 7
Source File: PaintNativeOnUpdate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(final String[] args) throws AWTException {
    final Frame frame = new Frame();
    final Component label = new PaintNativeOnUpdate();
    frame.setBackground(Color.RED);
    frame.add(label);
    frame.setSize(300, 300);
    frame.setUndecorated(true);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    label.repaint();// first paint
    sleep();
    label.repaint();// incremental paint
    sleep();

    Robot robot = new Robot();
    robot.setAutoDelay(50);
    Point point = label.getLocationOnScreen();
    Color color = robot.getPixelColor(point.x + label.getWidth() / 2,
                                      point.y + label.getHeight() / 2);
    if (!color.equals(Color.GREEN)) {
        System.err.println("Expected color = " + Color.GREEN);
        System.err.println("Actual color = " + color);
        throw new RuntimeException();
    }
    frame.dispose();
}
 
Example 8
Source File: BidiEmbeddingTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    // to regress embedding test against old fix, call with an arg.  A window will pop
    // up causing awt lib to be loaded so the vm won't die with the unsatisfied link error.
    if (args.length > 0) {
        Frame f = new Frame();
        f.setSize(300, 300);
        f.setBackground(Color.white);
        f.show();
    }

    test1();
    test2();
}
 
Example 9
Source File: PaintNativeOnUpdate.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(final String[] args) throws AWTException {
    final Frame frame = new Frame();
    final Component label = new PaintNativeOnUpdate();
    frame.setBackground(Color.RED);
    frame.add(label);
    frame.setSize(300, 300);
    frame.setUndecorated(true);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    label.repaint();// first paint
    sleep();
    label.repaint();// incremental paint
    sleep();

    Robot robot = new Robot();
    robot.setAutoDelay(50);
    Point point = label.getLocationOnScreen();
    Color color = robot.getPixelColor(point.x + label.getWidth() / 2,
                                      point.y + label.getHeight() / 2);
    if (!color.equals(Color.GREEN)) {
        System.err.println("Expected color = " + Color.GREEN);
        System.err.println("Actual color = " + color);
        throw new RuntimeException();
    }
    frame.dispose();
}
 
Example 10
Source File: BidiEmbeddingTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    // to regress embedding test against old fix, call with an arg.  A window will pop
    // up causing awt lib to be loaded so the vm won't die with the unsatisfied link error.
    if (args.length > 0) {
        Frame f = new Frame();
        f.setSize(300, 300);
        f.setBackground(Color.white);
        f.show();
    }

    test1();
    test2();
}
 
Example 11
Source File: BidiEmbeddingTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    // to regress embedding test against old fix, call with an arg.  A window will pop
    // up causing awt lib to be loaded so the vm won't die with the unsatisfied link error.
    if (args.length > 0) {
        Frame f = new Frame();
        f.setSize(300, 300);
        f.setBackground(Color.white);
        f.show();
    }

    test1();
    test2();
}
 
Example 12
Source File: MultiScreenLocationTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws AWTException
{
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    if (gds.length < 2) {
        System.out.println("It's a multiscreen test... skipping!");
        return;
    }

    for (int i = 0; i < gds.length; ++i) {
        GraphicsDevice gd = gds[i];
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        Rectangle screen = gc.getBounds();
        Robot robot = new Robot(gd);

        // check Robot.mouseMove()
        robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y);
        Point mouse = MouseInfo.getPointerInfo().getLocation();
        Point point = screen.getLocation();
        point.translate(mouseOffset.x, mouseOffset.y);
        if (!point.equals(mouse)) {
            throw new RuntimeException(getErrorText("Robot.mouseMove", i));
        }

        // check Robot.getPixelColor()
        Frame frame = new Frame(gc);
        frame.setUndecorated(true);
        frame.setSize(100, 100);
        frame.setLocation(screen.x + frameOffset.x, screen.y + frameOffset.y);
        frame.setBackground(color);
        frame.setVisible(true);
        robot.waitForIdle();
        Rectangle bounds = frame.getBounds();
        if (!Util.testBoundsColor(bounds, color, 5, 1000, robot)) {
            throw new RuntimeException(getErrorText("Robot.getPixelColor", i));
        }

        // check Robot.createScreenCapture()
        BufferedImage image = robot.createScreenCapture(bounds);
        int rgb = color.getRGB();
        if (image.getRGB(0, 0) != rgb
            || image.getRGB(image.getWidth() - 1, 0) != rgb
            || image.getRGB(image.getWidth() - 1, image.getHeight() - 1) != rgb
            || image.getRGB(0, image.getHeight() - 1) != rgb) {
                throw new RuntimeException(
                        getErrorText("Robot.createScreenCapture", i));
        }
        frame.dispose();
    }

    System.out.println("Test PASSED!");
}
 
Example 13
Source File: MultiScreenLocationTest.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
{
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    if (gds.length < 2) {
        System.out.println("It's a multiscreen test... skipping!");
        return;
    }

    for (int i = 0; i < gds.length; ++i) {
        GraphicsDevice gd = gds[i];
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        Rectangle screen = gc.getBounds();
        Robot robot = new Robot(gd);

        // check Robot.mouseMove()
        robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y);
        Point mouse = MouseInfo.getPointerInfo().getLocation();
        Point point = screen.getLocation();
        point.translate(mouseOffset.x, mouseOffset.y);
        if (!point.equals(mouse)) {
            throw new RuntimeException(getErrorText("Robot.mouseMove", i));
        }

        // check Robot.getPixelColor()
        Frame frame = new Frame(gc);
        frame.setUndecorated(true);
        frame.setSize(100, 100);
        frame.setLocation(screen.x + frameOffset.x, screen.y + frameOffset.y);
        frame.setBackground(color);
        frame.setVisible(true);
        robot.waitForIdle();
        Rectangle bounds = frame.getBounds();
        if (!Util.testBoundsColor(bounds, color, 5, 1000, robot)) {
            throw new RuntimeException(getErrorText("Robot.getPixelColor", i));
        }

        // check Robot.createScreenCapture()
        BufferedImage image = robot.createScreenCapture(bounds);
        int rgb = color.getRGB();
        if (image.getRGB(0, 0) != rgb
            || image.getRGB(image.getWidth() - 1, 0) != rgb
            || image.getRGB(image.getWidth() - 1, image.getHeight() - 1) != rgb
            || image.getRGB(0, image.getHeight() - 1) != rgb) {
                throw new RuntimeException(
                        getErrorText("Robot.createScreenCapture", i));
        }
        frame.dispose();
    }

    System.out.println("Test PASSED!");
}
 
Example 14
Source File: ComponentIsNotDrawnAfterRemoveAddTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public ComponentIsNotDrawnAfterRemoveAddTest() {
    frame = new Frame("ComponentIsNotDrawnAfterRemoveAddTest");
    frame.setSize(500, 500);
    frame.setLocation(200, 200);
    frame.setLayout(null);
    frame.setBackground(Color.RED);

    panel = new Panel();
    panel.setLayout(null);
    panel.setBounds(25, 100, 455, 295);
    panel.setBackground(Color.GREEN);

    for (int i = 0; i < 10; i++) {
        TestCanvas canv1 = new TestCanvas();
        canv1.setBounds(i * 45 + 5, 15, 30 + i, 30 + i);
        panel.add(canv1);
        compList.add(canv1);

        TestButton btn1 = new TestButton();
        btn1.setBounds(i * 45 + 5, 60, 30 + i, 30 + i);
        panel.add(btn1);
        compList.add(btn1);

        TestCanvas canv2 = new TestCanvas();
        canv2.setBounds(i * 45 + 5, 105, 30 + i, 30 + i);
        panel.add(canv2);
        compList.add(canv2);

        TestButton btn2 = new TestButton();
        btn2.setBounds(i * 45 + 5, 150, 30 + i, 30 + i);
        panel.add(btn2);
        compList.add(btn2);

        TestCanvas canv3 = new TestCanvas();
        canv3.setBounds(i * 45 + 5, 195, 30 + i, 30 + i);
        panel.add(canv3);
        compList.add(canv3);

        TestButton btn3 = new TestButton();
        btn3.setBounds(i * 45 + 5, 240, 30 + i, 30 + i);
        panel.add(btn3);
        compList.add(btn3);
    }

    frame.add(panel);
    frame.setVisible(true);
}
 
Example 15
Source File: IncorrectDisplayModeExitFullscreen.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(final String[] args) {

        final GraphicsDevice[] devices =
                GraphicsEnvironment.getLocalGraphicsEnvironment()
                                   .getScreenDevices();
        if (devices.length < 2 || devices[0].getDisplayModes().length < 2
                || !devices[0].isFullScreenSupported()
                || !devices[1].isFullScreenSupported()) {
            System.err.println("Testcase is not applicable");
            return;
        }
        final DisplayMode defaultDM = devices[0].getDisplayMode();
        final DisplayMode[] dms = devices[0].getDisplayModes();
        DisplayMode nonDefaultDM = null;

        for (final DisplayMode dm : dms) {
            if (!dm.equals(defaultDM)) {
                nonDefaultDM = dm;
                break;
            }
        }
        if (nonDefaultDM == null) {
            System.err.println("Testcase is not applicable");
            return;
        }

        final Frame frame = new Frame();
        frame.setBackground(Color.GREEN);
        frame.setUndecorated(true);
        try {
            devices[0].setFullScreenWindow(frame);
            sleep();
            devices[0].setDisplayMode(nonDefaultDM);
            sleep();
            devices[1].setFullScreenWindow(frame);
            sleep();
            if (!defaultDM.equals(devices[0].getDisplayMode())) {
                throw new RuntimeException("DisplayMode is not restored");
            }
        } finally {
            // cleaning up
            devices[0].setFullScreenWindow(null);
            devices[1].setFullScreenWindow(null);
            frame.dispose();
        }
    }
 
Example 16
Source File: MultiScreenLocationTest.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
{
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    if (gds.length < 2) {
        System.out.println("It's a multiscreen test... skipping!");
        return;
    }

    for (int i = 0; i < gds.length; ++i) {
        GraphicsDevice gd = gds[i];
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        Rectangle screen = gc.getBounds();
        Robot robot = new Robot(gd);

        // check Robot.mouseMove()
        robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y);
        Point mouse = MouseInfo.getPointerInfo().getLocation();
        Point point = screen.getLocation();
        point.translate(mouseOffset.x, mouseOffset.y);
        if (!point.equals(mouse)) {
            throw new RuntimeException(getErrorText("Robot.mouseMove", i));
        }

        // check Robot.getPixelColor()
        Frame frame = new Frame(gc);
        frame.setUndecorated(true);
        frame.setSize(100, 100);
        frame.setLocation(screen.x + frameOffset.x, screen.y + frameOffset.y);
        frame.setBackground(color);
        frame.setVisible(true);
        robot.waitForIdle();
        Rectangle bounds = frame.getBounds();
        if (!Util.testBoundsColor(bounds, color, 5, 1000, robot)) {
            throw new RuntimeException(getErrorText("Robot.getPixelColor", i));
        }

        // check Robot.createScreenCapture()
        BufferedImage image = robot.createScreenCapture(bounds);
        int rgb = color.getRGB();
        if (image.getRGB(0, 0) != rgb
            || image.getRGB(image.getWidth() - 1, 0) != rgb
            || image.getRGB(image.getWidth() - 1, image.getHeight() - 1) != rgb
            || image.getRGB(0, image.getHeight() - 1) != rgb) {
                throw new RuntimeException(
                        getErrorText("Robot.createScreenCapture", i));
        }
        frame.dispose();
    }

    System.out.println("Test PASSED!");
}
 
Example 17
Source File: IncorrectDisplayModeExitFullscreen.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(final String[] args) {

        final GraphicsDevice[] devices =
                GraphicsEnvironment.getLocalGraphicsEnvironment()
                                   .getScreenDevices();
        if (devices.length < 2 || devices[0].getDisplayModes().length < 2
                || !devices[0].isFullScreenSupported()
                || !devices[1].isFullScreenSupported()) {
            System.err.println("Testcase is not applicable");
            return;
        }
        final DisplayMode defaultDM = devices[0].getDisplayMode();
        final DisplayMode[] dms = devices[0].getDisplayModes();
        DisplayMode nonDefaultDM = null;

        for (final DisplayMode dm : dms) {
            if (!dm.equals(defaultDM)) {
                nonDefaultDM = dm;
                break;
            }
        }
        if (nonDefaultDM == null) {
            System.err.println("Testcase is not applicable");
            return;
        }

        try {
            robot = new ExtendedRobot();
        }catch(Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException("Unexpected failure");
        }

        final Frame frame = new Frame();
        frame.setBackground(Color.GREEN);
        frame.setUndecorated(true);
        try {
            devices[0].setFullScreenWindow(frame);
            sleep();
            devices[0].setDisplayMode(nonDefaultDM);
            sleep();
            devices[1].setFullScreenWindow(frame);
            sleep();
            if (!defaultDM.equals(devices[0].getDisplayMode())) {
                throw new RuntimeException("DisplayMode is not restored");
            }
        } finally {
            // cleaning up
            devices[0].setFullScreenWindow(null);
            devices[1].setFullScreenWindow(null);
            frame.dispose();
        }
    }
 
Example 18
Source File: IncorrectDisplayModeExitFullscreen.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static void main(final String[] args) {

        final GraphicsDevice[] devices =
                GraphicsEnvironment.getLocalGraphicsEnvironment()
                                   .getScreenDevices();
        if (devices.length < 2 || devices[0].getDisplayModes().length < 2
                || !devices[0].isFullScreenSupported()
                || !devices[1].isFullScreenSupported()) {
            System.err.println("Testcase is not applicable");
            return;
        }
        final DisplayMode defaultDM = devices[0].getDisplayMode();
        final DisplayMode[] dms = devices[0].getDisplayModes();
        DisplayMode nonDefaultDM = null;

        for (final DisplayMode dm : dms) {
            if (!dm.equals(defaultDM)) {
                nonDefaultDM = dm;
                break;
            }
        }
        if (nonDefaultDM == null) {
            System.err.println("Testcase is not applicable");
            return;
        }

        final Frame frame = new Frame();
        frame.setBackground(Color.GREEN);
        frame.setUndecorated(true);
        try {
            devices[0].setFullScreenWindow(frame);
            sleep();
            devices[0].setDisplayMode(nonDefaultDM);
            sleep();
            devices[1].setFullScreenWindow(frame);
            sleep();
            if (!defaultDM.equals(devices[0].getDisplayMode())) {
                throw new RuntimeException("DisplayMode is not restored");
            }
        } finally {
            // cleaning up
            devices[0].setFullScreenWindow(null);
            devices[1].setFullScreenWindow(null);
            frame.dispose();
        }
    }
 
Example 19
Source File: ComponentIsNotDrawnAfterRemoveAddTest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public ComponentIsNotDrawnAfterRemoveAddTest() {
    frame = new Frame("ComponentIsNotDrawnAfterRemoveAddTest");
    frame.setSize(500, 500);
    frame.setLocation(200, 200);
    frame.setLayout(null);
    frame.setBackground(Color.RED);

    panel = new Panel();
    panel.setLayout(null);
    panel.setBounds(25, 100, 455, 295);
    panel.setBackground(Color.GREEN);

    for (int i = 0; i < 10; i++) {
        TestCanvas canv1 = new TestCanvas();
        canv1.setBounds(i * 45 + 5, 15, 30 + i, 30 + i);
        panel.add(canv1);
        compList.add(canv1);

        TestButton btn1 = new TestButton();
        btn1.setBounds(i * 45 + 5, 60, 30 + i, 30 + i);
        panel.add(btn1);
        compList.add(btn1);

        TestCanvas canv2 = new TestCanvas();
        canv2.setBounds(i * 45 + 5, 105, 30 + i, 30 + i);
        panel.add(canv2);
        compList.add(canv2);

        TestButton btn2 = new TestButton();
        btn2.setBounds(i * 45 + 5, 150, 30 + i, 30 + i);
        panel.add(btn2);
        compList.add(btn2);

        TestCanvas canv3 = new TestCanvas();
        canv3.setBounds(i * 45 + 5, 195, 30 + i, 30 + i);
        panel.add(canv3);
        compList.add(canv3);

        TestButton btn3 = new TestButton();
        btn3.setBounds(i * 45 + 5, 240, 30 + i, 30 + i);
        panel.add(btn3);
        compList.add(btn3);
    }

    frame.add(panel);
    frame.setVisible(true);
}
 
Example 20
Source File: IncorrectDisplayModeExitFullscreen.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void main(final String[] args) {

        final GraphicsDevice[] devices =
                GraphicsEnvironment.getLocalGraphicsEnvironment()
                                   .getScreenDevices();
        if (devices.length < 2 || devices[0].getDisplayModes().length < 2
                || !devices[0].isFullScreenSupported()
                || !devices[1].isFullScreenSupported()) {
            System.err.println("Testcase is not applicable");
            return;
        }
        final DisplayMode defaultDM = devices[0].getDisplayMode();
        final DisplayMode[] dms = devices[0].getDisplayModes();
        DisplayMode nonDefaultDM = null;

        for (final DisplayMode dm : dms) {
            if (!dm.equals(defaultDM)) {
                nonDefaultDM = dm;
                break;
            }
        }
        if (nonDefaultDM == null) {
            System.err.println("Testcase is not applicable");
            return;
        }

        final Frame frame = new Frame();
        frame.setBackground(Color.GREEN);
        frame.setUndecorated(true);
        try {
            devices[0].setFullScreenWindow(frame);
            sleep();
            devices[0].setDisplayMode(nonDefaultDM);
            sleep();
            devices[1].setFullScreenWindow(frame);
            sleep();
            if (!defaultDM.equals(devices[0].getDisplayMode())) {
                throw new RuntimeException("DisplayMode is not restored");
            }
        } finally {
            // cleaning up
            devices[0].setFullScreenWindow(null);
            devices[1].setFullScreenWindow(null);
            frame.dispose();
        }
    }