GraphicsEnvironment.isHeadless() has the following syntax.
public static boolean isHeadless()
In the following code shows how to use GraphicsEnvironment.isHeadless() method.
import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; //w w w . j a v a 2 s .c o m public class Main { public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); System.out.println(ge.isHeadlessInstance()); } }
The code above generates the following result.