FullScreenMode in Java
<p>I've been following the book 'Developing games in Java' by David Brackeen and in chapter 2 he teaches how to use full screen mode. The problem i am having is that when i go to run his source code, all i get is a white screen. I've spent hours on this and i believe it has something to do with Windows 7. </p>

<p>Thanks for your time!</p>

<pre><code>import java.awt.*;

import javax.swing.JFrame;

/**
The SimpleScreenManager class manages initializing and
displaying full screen graphics modes.
*/
public class SimpleScreenManager {

private GraphicsDevice device;

/**
    Creates a new SimpleScreenManager object.
*/
public SimpleScreenManager() {
    GraphicsEnvironment environment =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    device = environment.getDefaultScreenDevice();

}


/**
    Enters full screen mode and changes the display mode.
*/
public void setFullScreen(DisplayMode displayMode,
    JFrame window)
{
    window.setUndecorated(true);
    window.setResizable(false);

    device.setFullScreenWindow(window);

    if (displayMode != null &amp;&amp;
        device.isDisplayChangeSupported())
    {
        try {
            device.setDisplayMode(displayMode);
        }
        catch (IllegalArgumentException ex) {
            // ignore - illegal mode for this device
        }
    }
}


/**
    Returns the window currently used in full screen mode.
*/
public Window getFullScreenWindow() {
    return device.getFullScreenWindow();
}


/**
    Restores the screen's display mode.
*/
public void restoreScreen() {
    Window window = device.getFullScreenWindow();
    if (window != null) {
        window.dispose();
    }
    device.setFullScreenWindow(null);
}

public static void main(String args[])
{
    SimpleScreenManager t = new SimpleScreenManager();
    try {

        t.setFullScreen(new DisplayMode(1920, 1080, 64, 0), new JFrame());
        Thread.sleep(2000);
    }
     catch (InterruptedException ex) { }
    finally {
        t.restoreScreen();
    }
}
</code></pre>

<p>}</p>
