List of usage examples for java.awt DisplayMode getBitDepth
public int getBitDepth()
From source file:Main.java
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++) { DisplayMode dm = dmodes[i]; if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI) { System.out.println("DisplayMode.BIT_DEPTH_MULTI"); }//from w w w . ja v a 2s. c om } }
From source file:Main.java
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++) { DisplayMode dm = dmodes[i]; int bitDepth = dm.getBitDepth(); }/*from w ww. j av a 2s. c o m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); for (int i = 0; i < gs.length; i++) { DisplayMode dm = gs[i].getDisplayMode(); int refreshRate = dm.getRefreshRate(); if (refreshRate == DisplayMode.REFRESH_RATE_UNKNOWN) { System.out.println("Unknown rate"); }/*from w w w . jav a2 s. co m*/ int bitDepth = dm.getBitDepth(); int numColors = (int) Math.pow(2, bitDepth); } }
From source file:DisplayModeModel.java
public void setDMLabel(DisplayMode newMode) { int bitDepth = newMode.getBitDepth(); int refreshRate = newMode.getRefreshRate(); String bd, rr;/*w ww . j a v a 2 s . com*/ if (bitDepth == DisplayMode.BIT_DEPTH_MULTI) { bd = "Multi"; } else { bd = Integer.toString(bitDepth); } if (refreshRate == DisplayMode.REFRESH_RATE_UNKNOWN) { rr = "Unknown"; } else { rr = Integer.toString(refreshRate); } currentDM.setText(COLUMN_NAMES[INDEX_WIDTH] + ": " + newMode.getWidth() + " " + COLUMN_NAMES[INDEX_HEIGHT] + ": " + newMode.getHeight() + " " + COLUMN_NAMES[INDEX_BITDEPTH] + ": " + bd + " " + COLUMN_NAMES[INDEX_REFRESHRATE] + ": " + rr); }
From source file:DisplayModeModel.java
public Object getValueAt(int rowIndex, int colIndex) { DisplayMode dm = modes[rowIndex]; switch (colIndex) { case DisplayModeTest.INDEX_WIDTH: return Integer.toString(dm.getWidth()); case DisplayModeTest.INDEX_HEIGHT: return Integer.toString(dm.getHeight()); case DisplayModeTest.INDEX_BITDEPTH: { int bitDepth = dm.getBitDepth(); String ret;/* www. j a v a 2s .co m*/ if (bitDepth == DisplayMode.BIT_DEPTH_MULTI) { ret = "Multi"; } else { ret = Integer.toString(bitDepth); } return ret; } case DisplayModeTest.INDEX_REFRESHRATE: { int refreshRate = dm.getRefreshRate(); String ret; if (refreshRate == DisplayMode.REFRESH_RATE_UNKNOWN) { ret = "Unknown"; } else { ret = Integer.toString(refreshRate); } return ret; } } throw new ArrayIndexOutOfBoundsException("Invalid column value"); }
From source file:Filter3dTest.java
/** * Determines if two display modes "match". Two display modes match if they * have the same resolution, bit depth, and refresh rate. The bit depth is * ignored if one of the modes has a bit depth of * DisplayMode.BIT_DEPTH_MULTI. Likewise, the refresh rate is ignored if one * of the modes has a refresh rate of DisplayMode.REFRESH_RATE_UNKNOWN. *//*from w w w . jav a 2s . c o m*/ public boolean displayModesMatch(DisplayMode mode1, DisplayMode mode2) { if (mode1.getWidth() != mode2.getWidth() || mode1.getHeight() != mode2.getHeight()) { return false; } if (mode1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode1.getBitDepth() != mode2.getBitDepth()) { return false; } if (mode1.getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN && mode2.getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN && mode1.getRefreshRate() != mode2.getRefreshRate()) { return false; } return true; }