FileDocCategorySizeDatePackage
DisplayMode.javaAPI DocJava SE 6 API4088Tue Jun 10 00:25:14 BST 2008java.awt

DisplayMode

public final class DisplayMode extends Object
The DisplayMode class encapsulates the bit depth, height, width, and refresh rate of a GraphicsDevice. The ability to change graphics device's display mode is platform- and configuration-dependent and may not always be available (see {@link GraphicsDevice#isDisplayChangeSupported}).

For more information on full-screen exclusive mode API, see the Full-Screen Exclusive Mode API Tutorial.

see
GraphicsDevice
see
GraphicsDevice#isDisplayChangeSupported
see
GraphicsDevice#getDisplayModes
see
GraphicsDevice#setDisplayMode
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 display 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)
Returns whether the two display modes are equal.

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)
{@inheritDoc}

	if (dm instanceof DisplayMode) {
	    return equals((DisplayMode)dm);
	} else {
	    return false;
	}
    
public intgetBitDepth()
Returns 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.

return
the bit depth of the display, in bits per pixel.
see
#BIT_DEPTH_MULTI

    
                                                
       
        return bitDepth;
    
public intgetHeight()
Returns the height of the display, in pixels.

return
the height of the display, in pixels

        return size.height;
    
public intgetRefreshRate()
Returns the refresh rate of the display, in hertz. This may be REFRESH_RATE_UNKNOWN if the information is not available.

return
the refresh rate of the display, in hertz.
see
#REFRESH_RATE_UNKNOWN

    
                                        
       
        return refreshRate;
    
public intgetWidth()
Returns the width of the display, in pixels.

return
the width of the display, in pixels

        return size.width;
    
public inthashCode()
{@inheritDoc}

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