Take the 2-minute tour ×

I'm trying to add fullscreen functionality to my program but I couldn't get it to work. I'm trying


I tried changing its position to above where I create the display or where I set the displaymode, but still not working. Any help about this?

share|improve this question
Does Display.setDisplayModeAndFullscreen(Display.getDesktopDisplayMode()) work? –  Oskar Sep 6 '12 at 13:56
add comment

1 Answer

up vote 6 down vote accepted

From my experience the DisplayMode needs to support it. You can try this:

        DisplayMode displayMode = null;
        DisplayMode[] modes = Display.getAvailableDisplayModes();

         for (int i = 0; i < modes.length; i++)
             if (modes[i].getWidth() == width
             && modes[i].getHeight() == height
             && modes[i].isFullscreenCapable())
                    displayMode = modes[i];

After doing this your Display.setFullscreen(true) should work

share|improve this answer
Yes it works this way, thanks. However I don't understand why when I use the exact same width and height creating a new DisplayMode it doesn't work, but when I pass in a DisplayMode from the getAvailableDisplayModes() method it works? –  Mertcan Ekiz Sep 10 '12 at 16:36
Because width and height is not unique for different display modes. Creating a new display mode actually hands you a default display mode which does not support fullscreen. –  Gorky Apr 23 '13 at 19:40
add comment

Your Answer


