Search code examples
javamonitor

isFullScreenSupported always true for monitors


Given the following code

 GraphicsDevice screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0];
 if (screen.isFullScreenSupported()) {
      //is it always true for monitors?
 }

Is screen.isFullScreenSupported() always true for monitors?


Solution

  • No, it may not be true.

    The SecurityManager might disallow you the full screen control. Mainly because one could easily fake whole screen in order to grab a password from not-suspecting user (you could mock a bank website).

    It can be false:

    • in an applet
    • in a WebStart Application
    • while running in headless mode

    JavaDOC of GraphicsDevice.isFullScreenSupported:

    Returns true if this GraphicsDevice supports full-screen exclusive mode. If a SecurityManager is installed, its checkPermission method will be called with AWTPermission("fullScreenExclusive"). isFullScreenSupported returns true only if that permission is granted