Start Search Contents Index Links About
ShowDisplaySettings.java
/*
 * Author: Havard Rast Blok
 * E-mail:  
 * Web   : www.rememberjava.com
 */

import java.awt.*;

/**
 * Shows info about the screen.
 */
public class ShowDisplaySettings
{
  
  public static void main(String[] args)
  {
    GraphicsEnvironment ge;
    GraphicsDevice gd;
    DisplayMode dm;
    int width, height, bitDepth, refreshRate;
    
    ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    gd = ge.getDefaultScreenDevice();
    dm = gd.getDisplayMode();
    
    width = dm.getWidth();
    height = dm.getHeight();
    bitDepth = dm.getBitDepth();
    refreshRate = dm.getRefreshRate();
    
    System.out.println("Resolution: "+width+"x"+height);
    System.out.println("Color bit depth: "+bitDepth+" (BIT_DEPTH_MULTI="+DisplayMode.BIT_DEPTH_MULTI+")");
    System.out.println("Screen refresh rate: "+refreshRate+" (REFRESH_RATE_UNKNOWN="+DisplayMode.REFRESH_RATE_UNKNOWN+")");
  }
  
}


site: Håvard Rast Blok
mail:
updated: 27 July 2007