DisplayModepublic 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. |
Fields Summary |
---|
private Dimension | size | private int | bitDepth | private int | refreshRate | public static final int | BIT_DEPTH_MULTIValue of the bit depth if multiple bit depths are supported in this
display mode. | public static final int | REFRESH_RATE_UNKNOWNValue 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.
this.size = new Dimension(width, height);
this.bitDepth = bitDepth;
this.refreshRate = refreshRate;
|
Methods Summary |
---|
public boolean | equals(java.awt.DisplayMode dm)Returns 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 boolean | equals(java.lang.Object dm){@inheritDoc}
if (dm instanceof DisplayMode) {
return equals((DisplayMode)dm);
} else {
return false;
}
| public int | getBitDepth()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 bitDepth;
| public int | getHeight()Returns the height of the display, in pixels.
return size.height;
| public int | getRefreshRate()Returns the refresh rate of the display, in hertz. This may be
REFRESH_RATE_UNKNOWN if the information is not available.
return refreshRate;
| public int | getWidth()Returns the width of the display, in pixels.
return size.width;
| public int | hashCode(){@inheritDoc}
return getWidth() + getHeight() + getBitDepth() * 7
+ getRefreshRate() * 13;
|
|