FileDocCategorySizeDatePackage
DisplayMode.javaAPI DocJava SE 5 API3389Fri Aug 26 14:56:44 BST 2005java.awt

DisplayMode

public final class DisplayMode extends Object
The DisplayMode class encapsulates the bit depth, height, width, and refresh rate of a GraphicsDevice. Display modes are hardware-dependent and may not always be available.
see
GraphicsDevice
author
Michael Martak
since
1.4

Fields Summary
private Dimension
size
private int
bitDepth
private int
refreshRate
public static final int
BIT_DEPTH_MULTI
Value of the bit depth if multiple bit depths are supported in this dislay mode.
public static final int
REFRESH_RATE_UNKNOWN
Value of the refresh rate if not known
Constructors Summary
public DisplayMode(int width, int height, int bitDepth, int refreshRate)
Create a new display mode object with the supplied parameters.

param
width the width of the display, in pixels
param
height the height of the display, in pixels
param
bitDepth the bit depth of the display, in bits per pixel. This can be BIT_DEPTH_MULTI if multiple bit depths are available.
param
refreshRate the refresh rate of the display, in hertz. This can be REFRESH_RATE_UNKNOWN if the information is not available.
see
#BIT_DEPTH_MULTI
see
#REFRESH_RATE_UNKNOWN

        this.size = new Dimension(width, height);
        this.bitDepth = bitDepth;
        this.refreshRate = refreshRate;
    
Methods Summary
public booleanequals(java.awt.DisplayMode dm)

return
whether the two display modes are equal

	if (dm == null) {
	    return false;
	}
        return (getHeight() == dm.getHeight()
            && getWidth() == dm.getWidth()
            && getBitDepth() == dm.getBitDepth()
            && getRefreshRate() == dm.getRefreshRate());
    
public booleanequals(java.lang.Object dm)

return
whether the two display modes are equal

	if (dm instanceof DisplayMode) {
	    return equals((DisplayMode)dm);
	} else {
	    return false;
	}
    
public intgetBitDepth()

return
the bit depth of the display, in bits per pixel. This may be BIT_DEPTH_MULTI if multiple bit depths are supported in this display mode.
see
#BIT_DEPTH_MULTI

                                     
       
        return bitDepth;
    
public intgetHeight()

return
the height of the display, in pixels

        return size.height;
    
public intgetRefreshRate()

return
the refresh rate of the display, in hertz. This may be REFRESH_RATE_UNKNOWN if the information is not available.
see
#REFRESH_RATE_UNKNOWN

                               
       
        return refreshRate;
    
public intgetWidth()

return
the width of the display, in pixels

        return size.width;
    
public inthashCode()

return
a hash code value for this object

        return getWidth() + getHeight() + getBitDepth() * 7
            + getRefreshRate() * 13;