Java Swing Tutorial - Java DisplayMode BIT_DEPTH_MULTI








Syntax

DisplayMode.BIT_DEPTH_MULTI has the following syntax.

public static final int BIT_DEPTH_MULTI

Example

In the following code shows how to use DisplayMode.BIT_DEPTH_MULTI field.

import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
// w ww.  j  ava 2 s  . c om
public class Main {
  public static void main(String[] argv) throws Exception {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();

    DisplayMode[] dmodes = gs.getDisplayModes();
    for (int i = 0; i < dmodes.length; i++) {
      if(dmodes[i].getBitDepth() == DisplayMode.BIT_DEPTH_MULTI){
        System.out.println("DisplayMode.BIT_DEPTH_MULTI");
      }
    }
  }
}