Determine if full-screen mode is supported directly in Java

Description

The following code shows how to determine if full-screen mode is supported directly.

Example


  /* ww  w .  j  a  v a 2 s.  c  o  m*/


import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Main {
  public static void main(String[] argv) throws Exception {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    if (gs.isFullScreenSupported()) {
      // Full-screen mode is supported
    } else {
      // Full-screen mode will be simulated
    }
  }
}




















Home »
  Java Tutorial »
    Graphics »




Animation
BufferedImage
Color
Font
Gradient
Graphics Settings
Image
Mouse Draw
Print
Shape
Text
Transform