SizeAndRRate, consist out of non rotated surface size, refresh rate and flags.rotation, measured counter clockwise (CCW)MonitorDevice Selection:
MonitorDevices is accessible via Screen#getMonitorDevices().Window#getMainMonitor().Screen#getMainMonitor(RectangleImmutable).MonitorDevice#getCurrentMode().MonitorDevice#getOriginalMode().MonitorMode Filtering:
MonitorDevice's MonitorModes is accessible via MonitorDevice#getSupportedModes().MonitorModeUtil to filter and select a desired MonitorMode.MonitorDevice#setCurrentMode(MonitorMode)
to change the current MonitorMode for all Screens referenced via the full qualified name (FQN).original mode is restored when
// Pick the monitor:
// Either the one used by a window ..
MonitorDevice monitor = window.getMainMonitor();
// Or arbitrary from the list ..
List allMonitor = getMonitorDevices();
MonitorDevice monitor = allMonitor.get(0);
// Current and original modes ..
MonitorMode mmCurrent = monitor.queryCurrentMode();
MonitorMode mmOrig = monitor.getOriginalMode();
// Target resolution in pixel units
DimensionImmutable res = new Dimension(800, 600);
// Target refresh rate shall be similar to current one ..
float freq = mmCurrent.getRefreshRate();
// Target rotation shall be similar to current one
int rot = mmCurrent.getRotation();
// Filter criterias sequential out of all available MonitorMode of the chosen MonitorDevice
List monitorModes = monitor.getSupportedModes();
monitorModes = MonitorModeUtil.filterByFlags(monitorModes, 0); // no interlace, double-scan etc
monitorModes = MonitorModeUtil.filterByRotation(monitorModes, rot);
monitorModes = MonitorModeUtil.filterByResolution(monitorModes, res);
monitorModes = MonitorModeUtil.filterByRate(monitorModes, freq);
monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes);
// pick 1st one and set to current ..
MonitorMode mm = monitorModes.get(0);
monitor.setCurrentMode(mm);
| Modifier and Type | Class and Description |
|---|---|
| public static class | MonitorMode.
Immutable surfaceSize, flags and refreshRate Class, consisting of it's read only components:
|
| Modifier and Type | Field and Description |
|---|---|
| public static final int | FLAG_DOUBLESCAN
Lines are doubled. |
| public static final int | FLAG_INTERLACE
Frame is split into two fields. |
| private final int | |
| public static final Comparator | monitorModeComparator
Comparator for 2 |
| public static final Comparator | monitorModeComparatorInv
Comparator for 2 |
| private final int | nativeId
The immutable native Id of this instance, which may not be unique. |
| public static final int | ROTATE_0
zero rotation, compared to normal settings |
| public static final int | ROTATE_180
180 degrees CCW rotation |
| public static final int | ROTATE_270
270 degrees CCW rotation |
| public static final int | ROTATE_90
90 degrees CCW rotation |
| private final int | |
| private final MonitorMode. |
| Access | Constructor and Description |
|---|---|
| public | MonitorMode(final int nativeId, final MonitorMode.
the surface size and refresh rate mode sizeAndRRate,the screen rotation, measured counter clockwise (CCW) rotation)
|
| public | MonitorMode(final SurfaceSize surfaceSize, final float refreshRate, final int flags, final int rotation)
Creates a user instance w/o |
| Modifier and Type | Method and Description |
|---|---|
| public int | compareTo(final MonitorMode
the object to be compared. mm)Implements java.
Compares |
| public final boolean | equals(final Object
the reference object with which to compare. obj)Overrides java. MonitorMode objects
by evaluating equality of it's components:
|
| public final int | |
| private final int | |
| public final int | |
| public final float | |
| public final int | getRotatedHeight()
Returns the rotated screen height in pixel units,
derived from |
| private final int | |
| public final int | getRotatedWidth()
Returns the rotated screen width in pixel units,
derived from |
| public final int | |
| public final MonitorMode. | |
| public final SurfaceSize | |
| public final int | hashCode()
Overrides java.
|
| public static boolean | |
| public final String |
| FLAG_DOUBLESCAN | back to summary |
|---|---|
| public static final int FLAG_DOUBLESCAN Lines are doubled. See | |
| FLAG_INTERLACE | back to summary |
|---|---|
| public static final int FLAG_INTERLACE Frame is split into two fields. See | |
| hashCode | back to summary |
|---|---|
| private final int hashCode | |
| monitorModeComparator | back to summary |
|---|---|
| public static final Comparator<MonitorMode> monitorModeComparator Comparator for 2 | |
| monitorModeComparatorInv | back to summary |
|---|---|
| public static final Comparator<MonitorMode> monitorModeComparatorInv Comparator for 2 | |
| nativeId | back to summary |
|---|---|
| private final int nativeId The immutable native Id of this instance, which may not be unique. | |
| ROTATE_0 | back to summary |
|---|---|
| public static final int ROTATE_0 zero rotation, compared to normal settings | |
| ROTATE_180 | back to summary |
|---|---|
| public static final int ROTATE_180 180 degrees CCW rotation | |
| ROTATE_270 | back to summary |
|---|---|
| public static final int ROTATE_270 270 degrees CCW rotation | |
| ROTATE_90 | back to summary |
|---|---|
| public static final int ROTATE_90 90 degrees CCW rotation | |
| rotation | back to summary |
|---|---|
| private final int rotation | |
| sizeAndRRate | back to summary |
|---|---|
| private final MonitorMode. | |
| MonitorMode | back to summary |
|---|---|
public MonitorMode(final int nativeId, final MonitorMode.
| |
| MonitorMode | back to summary |
|---|---|
| public MonitorMode(final SurfaceSize surfaceSize, final float refreshRate, final int flags, final int rotation) Creates a user instance w/o
See | |
| compareTo | back to summary |
|---|---|
| public int compareTo(final MonitorMode mm) Implements java. Doc from java.
Compares
Rotation is compared inverted, i.e. Order of comparing MonitorMode:
The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| equals | back to summary |
|---|---|
| public final boolean equals(final Object obj) Overrides java. Tests equality of two
| |
| getFlags | back to summary |
|---|---|
| public final int getFlags() Returns bitfield w/ flags, i.e. | |
| getHashCode | back to summary |
|---|---|
| private final int getHashCode() | |
| getId | back to summary |
|---|---|
public final int getId()
| |
| getRefreshRate | back to summary |
|---|---|
| public final float getRefreshRate() Returns the vertical refresh rate. | |
| getRotatedHeight | back to summary |
|---|---|
| public final int getRotatedHeight() Returns the rotated screen height in pixel units,
derived from | |
| getRotatedWH | back to summary |
|---|---|
| private final int getRotatedWH(final boolean width) | |
| getRotatedWidth | back to summary |
|---|---|
| public final int getRotatedWidth() Returns the rotated screen width in pixel units,
derived from | |
| getRotation | back to summary |
|---|---|
| public final int getRotation() Returns the CCW rotation of this mode | |
| getSizeAndRRate | back to summary |
|---|---|
| public final MonitorMode. Returns the surfaceSize and refreshRate instance. | |
| getSurfaceSize | back to summary |
|---|---|
| public final SurfaceSize getSurfaceSize() Returns the unrotated | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Overrides java. Returns a combined hash code of it's elements:
| |
| isRotationValid | back to summary |
|---|---|
| public static boolean isRotationValid(final int rotation) | |
| toString | back to summary |
|---|---|
| public final String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
SurfaceSize surface memory sizeflagsrefresh rate| Modifier and Type | Field and Description |
|---|---|
| public final int | flags
Mode bitfield flags, i.e. |
| public final int | |
| public final float | refreshRate
Vertical refresh rate |
| private static final String | |
| private static final String | |
| private static final String | |
| public final SurfaceSize | surfaceSize
Non rotated surface size in pixel units |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | compareTo(final MonitorMode.
the object to be compared. sszrImplements java.
Compares |
| public final boolean | equals(final Object
the reference object with which to compare. obj)Overrides java. SizeAndRRate objects
by evaluating equality of it's components:
|
| public static final StringBuilder | |
| private final int | |
| public final int | hashCode()
Overrides java.
|
| public final String |
| flags | back to summary |
|---|---|
| public final int flags Mode bitfield flags, i.e. | |
| hashCode | back to summary |
|---|---|
| public final int hashCode | |
| refreshRate | back to summary |
|---|---|
| public final float refreshRate Vertical refresh rate | |
| STR_DOUBLESCAN | back to summary |
|---|---|
| private static final String STR_DOUBLESCAN | |
| STR_INTERLACE | back to summary |
|---|---|
| private static final String STR_INTERLACE | |
| STR_SEP | back to summary |
|---|---|
| private static final String STR_SEP | |
| surfaceSize | back to summary |
|---|---|
| public final SurfaceSize surfaceSize Non rotated surface size in pixel units | |
| SizeAndRRate | back to summary |
|---|---|
| public SizeAndRRate(final SurfaceSize surfaceSize, final float refreshRate, final int flags) | |
| compareTo | back to summary |
|---|---|
| public int compareTo(final MonitorMode. Implements java. Doc from java.
Compares Flags are compared as follows: NONE > DOUBLESCAN > INTERLACE Refresh rate differences of < 0.01 are considered equal (epsilon). Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| equals | back to summary |
|---|---|
| public final boolean equals(final Object obj) Overrides java. Tests equality of two
| |
| flags2String | back to summary |
|---|---|
| public static final StringBuilder flags2String(final int flags) | |
| getHashCode | back to summary |
|---|---|
| private final int getHashCode() | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Overrides java. Returns a combined hash code of it's elements:
| |
| toString | back to summary |
|---|---|
| public final String toString() Overrides java. Doc from java. Returns a string representation of the object. | |