Java DisplayMode REFRESH_RATE_UNKNOWN

Syntax

DisplayMode.REFRESH_RATE_UNKNOWN has the following syntax.

public static final int REFRESH_RATE_UNKNOWN

Example

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


import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
/*from   w  ww .ja  va 2s .c o m*/
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);
    }
  }
}




















Home »
  Java Tutorial »
    java.awt »




BasicStroke
BorderLayout
CardLayout
Color
Cursor
Desktop
DesktopManager
DisplayMode
EventQueue
FlowLayout
FocusTraversalPolicy
Font
FontMetrics
GradientPaint
Graphics
Graphics2D
GraphicsConfiguration
GraphicsDevice
GraphicsEnvironment
GridBagConstraints
GridBagLayout
GridLayout
Image
ItemSelectable
KeyboardFocusManager
LayoutManager
LayoutManager2
Point
Rectangle
Robot
Shape
SplashScreen
SystemColor
SystemTray
TexturePaint
TrayIcon
Toolkit
Transparency