Java DisplayMode.getBitDepth()
Syntax
DisplayMode.getBitDepth() has the following syntax.
public int getBitDepth()
Example
In the following code shows how to use DisplayMode.getBitDepth() method.
/*ww w.j a v a 2 s.c om*/
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
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++) {
int bitDepth = dmodes[i].getBitDepth();
}
}
}
Home »
Java Tutorial »
java.awt »
Java Tutorial »
java.awt »