Java Swing Tutorial - Java GraphicsEnvironment .getScreenDevices ()








Syntax

GraphicsEnvironment.getScreenDevices() has the following syntax.

public abstract GraphicsDevice [] getScreenDevices()      throws HeadlessException

Example

In the following code shows how to use GraphicsEnvironment.getScreenDevices() method.

// w  w  w.j  ava2s .  c o  m
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;

public class Main {
  public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] defaultScreens = ge.getScreenDevices();
    
  }
}