public static void goFullScreen(JFrame frame, DisplayMode displayMode) {
private static void goFullScreen(JFrame frame, DisplayMode displayMode) {
    public static void goFullScreen(JFrame frame, DisplayMode displayMode) {        GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment()                                                   .getDefaultScreenDevice();        /* We need to make the frame not displayable before calling         * setUndecorated(true) otherwise a java.awt.IllegalComponentStateException         * will get thrown.         */        if (frame.isDisplayable()) {            frame.dispose();        }        frame.setUndecorated(true);        device.setFullScreenWindow(frame);        if (device.isDisplayChangeSupported()) {            if (null == displayMode) {                displayMode = getBestDisplayMode(device);            }            if (null != displayMode) {                device.setDisplayMode(displayMode);            }        }        frame.validate();    }