Java Swing Tutorial - Java GraphicsDevice.getIDstring()








Syntax

GraphicsDevice.getIDstring() has the following syntax.

public abstract String getIDstring()

Example

In the following code shows how to use GraphicsDevice.getIDstring() method.

import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
//from  www  . ja v  a  2s .c o m
public class Main {

  public static void main(String[] a) throws Exception {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] screenDevices = ge.getScreenDevices();
    for (int i = 0; i < screenDevices.length; i++)
      System.out.println(screenDevices[i].getIDstring());
  }
}

The code above generates the following result.