DisplayMode.REFRESH_RATE_UNKNOWN : DisplayMode « java.awt « Java by API






DisplayMode.REFRESH_RATE_UNKNOWN

  
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.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"); 
      }

      int bitDepth = dm.getBitDepth();
      int numColors = (int) Math.pow(2, bitDepth);
    }
  }
}

   
    
  








Related examples in the same category

1.new DisplayMode(int width, int height, int bitDepth, int refreshRate)
2.DisplayMode: getBitDepth()
3.DisplayMode: getHeight()
4.DisplayMode: getRefreshRate()
5.DisplayMode: getWidth()