public static void setDisplayMode()
    {
        if (device == null)
        {
            environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
            device = environment.getDefaultScreenDevice();
        }
        
        DisplayMode displayMode = DisplayMonitor.getBestDisplayMode(device);
        if (device.isDisplayChangeSupported())
        {
            device.setDisplayMode(displayMode);
        }
        screen = new Dimension(device.getDisplayMode().getWidth(),
                device.getDisplayMode().getHeight());
    }