public final class DisplayMode extends Object
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 GraphicsDevice.isDisplayChangeSupported()
).
For more information on full-screen exclusive mode API, see the Full-Screen Exclusive Mode API Tutorial.
Modifier and Type | Field and Description |
---|---|
static int |
BIT_DEPTH_MULTI
Value of the bit depth if multiple bit depths are supported in this
display mode.
|
static int |
REFRESH_RATE_UNKNOWN
Value of the refresh rate if not known.
|
Constructor and Description |
---|
DisplayMode(int width,
int height,
int bitDepth,
int refreshRate)
Create a new display mode object with the supplied parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(DisplayMode dm)
Returns whether the two display modes are equal.
|
boolean |
equals(Object dm)
Compares the argument to the receiver, and answers true
if they represent the same object using a class
specific comparison.
|
int |
getBitDepth()
Returns the bit depth of the display, in bits per pixel.
|
int |
getHeight()
Returns the height of the display, in pixels.
|
int |
getRefreshRate()
Returns the refresh rate of the display, in hertz.
|
int |
getWidth()
Returns the width of the display, in pixels.
|
int |
hashCode()
Answers an integer hash code for the receiver.
|
@Native public static final int BIT_DEPTH_MULTI
getBitDepth()
,
Constant Field Values@Native public static final int REFRESH_RATE_UNKNOWN
getRefreshRate()
,
Constant Field Valuespublic DisplayMode(int width, int height, int bitDepth, int refreshRate)
width
- the width of the display, in pixelsheight
- the height of the display, in pixelsbitDepth
- the bit depth of the display, in bits per
pixel. This can be BIT_DEPTH_MULTI
if multiple
bit depths are available.refreshRate
- the refresh rate of the display, in hertz.
This can be REFRESH_RATE_UNKNOWN
if the
information is not available.BIT_DEPTH_MULTI
,
REFRESH_RATE_UNKNOWN
public int getHeight()
public int getWidth()
public int getBitDepth()
BIT_DEPTH_MULTI
if multiple bit depths are supported in
this display mode.BIT_DEPTH_MULTI
public int getRefreshRate()
REFRESH_RATE_UNKNOWN
if the information is not available.REFRESH_RATE_UNKNOWN
public boolean equals(DisplayMode dm)
public boolean equals(Object dm)
equals
in class Object
dm
- Object
the object to compare with this object.true
if the object is the same as this object
false
if it is different from this object.Object.hashCode()
public int hashCode()
true
when passed to
.equals
must answer the same value for this
method.hashCode
in class Object
Object.equals(java.lang.Object)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.