Java Code Examples for java.awt.DisplayMode#equals()
The following examples show how to use
java.awt.DisplayMode#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DisplayModeChanger.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Finds a display mode that is different from the current display * mode and is likely to cause a display change event. */ private static DisplayMode findDisplayMode(GraphicsDevice gd) { DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (!dm.equals(currentDM) && dm.getRefreshRate() == currentDM.getRefreshRate()) { // different from the current dm and refresh rate is the same // means that something else is different => more likely to // cause a DM change event return dm; } } return null; }
Example 2
Source File: DisplayModeChanger.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Finds a display mode that is different from the current display * mode and is likely to cause a display change event. */ private static DisplayMode findDisplayMode(GraphicsDevice gd) { DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (!dm.equals(currentDM) && dm.getRefreshRate() == currentDM.getRefreshRate()) { // different from the current dm and refresh rate is the same // means that something else is different => more likely to // cause a DM change event return dm; } } return null; }
Example 3
Source File: Win32GraphicsDevice.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 4
Source File: DisplayModeChanger.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Finds a display mode that is different from the current display * mode and is likely to cause a display change event. */ private static DisplayMode findDisplayMode(GraphicsDevice gd) { DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (!dm.equals(currentDM) && dm.getRefreshRate() == currentDM.getRefreshRate()) { // different from the current dm and refresh rate is the same // means that something else is different => more likely to // cause a DM change event return dm; } } return null; }
Example 5
Source File: X11GraphicsDevice.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 6
Source File: Win32GraphicsDevice.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 7
Source File: DisplayModeChanger.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Finds a display mode that is different from the current display * mode and is likely to cause a display change event. */ private static DisplayMode findDisplayMode(GraphicsDevice gd) { DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (!dm.equals(currentDM) && dm.getRefreshRate() == currentDM.getRefreshRate()) { // different from the current dm and refresh rate is the same // means that something else is different => more likely to // cause a DM change event return dm; } } return null; }
Example 8
Source File: Win32GraphicsDevice.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 9
Source File: Win32GraphicsDevice.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
protected synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 10
Source File: X11GraphicsDevice.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 11
Source File: CheckDisplayModes.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice graphicDevice = ge.getDefaultScreenDevice(); if (!graphicDevice.isDisplayChangeSupported()) { System.err.println("Display mode change is not supported on this host. Test is considered passed."); return; } DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode(); checkDisplayMode(defaultDisplayMode); graphicDevice.setDisplayMode(defaultDisplayMode); DisplayMode[] displayModes = graphicDevice.getDisplayModes(); boolean isDefaultDisplayModeIncluded = false; for (DisplayMode displayMode : displayModes) { checkDisplayMode(displayMode); graphicDevice.setDisplayMode(displayMode); if (defaultDisplayMode.equals(displayMode)) { isDefaultDisplayModeIncluded = true; } } if (!isDefaultDisplayModeIncluded) { throw new RuntimeException("Default display mode is not included"); } }
Example 12
Source File: DisplayModeChanger.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Finds a display mode that is different from the current display * mode and is likely to cause a display change event. */ private static DisplayMode findDisplayMode(GraphicsDevice gd) { DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (!dm.equals(currentDM) && dm.getRefreshRate() == currentDM.getRefreshRate()) { // different from the current dm and refresh rate is the same // means that something else is different => more likely to // cause a DM change event return dm; } } return null; }
Example 13
Source File: X11GraphicsDevice.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 14
Source File: CheckDisplayModes.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice graphicDevice = ge.getDefaultScreenDevice(); if (!graphicDevice.isDisplayChangeSupported()) { System.err.println("Display mode change is not supported on this host. Test is considered passed."); return; } DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode(); checkDisplayMode(defaultDisplayMode); graphicDevice.setDisplayMode(defaultDisplayMode); DisplayMode[] displayModes = graphicDevice.getDisplayModes(); boolean isDefaultDisplayModeIncluded = false; for (DisplayMode displayMode : displayModes) { checkDisplayMode(displayMode); graphicDevice.setDisplayMode(displayMode); if (defaultDisplayMode.equals(displayMode)) { isDefaultDisplayModeIncluded = true; } } if (!isDefaultDisplayModeIncluded) { throw new RuntimeException("Default display mode is not included"); } }
Example 15
Source File: DisplayModeChanger.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Finds a display mode that is different from the current display * mode and is likely to cause a display change event. */ private static DisplayMode findDisplayMode(GraphicsDevice gd) { DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (!dm.equals(currentDM) && dm.getRefreshRate() == currentDM.getRefreshRate()) { // different from the current dm and refresh rate is the same // means that something else is different => more likely to // cause a DM change event return dm; } } return null; }
Example 16
Source File: CheckDisplayModes.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); for (GraphicsDevice graphicDevice : ge.getScreenDevices()) { if (!graphicDevice.isDisplayChangeSupported()) { System.err.println("Display mode change is not supported on this host. Test is considered passed."); continue; } DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode(); checkDisplayMode(defaultDisplayMode); graphicDevice.setDisplayMode(defaultDisplayMode); DisplayMode[] displayModes = graphicDevice.getDisplayModes(); boolean isDefaultDisplayModeIncluded = false; for (DisplayMode displayMode : displayModes) { checkDisplayMode(displayMode); graphicDevice.setDisplayMode(displayMode); if (defaultDisplayMode.equals(displayMode)) { isDefaultDisplayModeIncluded = true; } } if (!isDefaultDisplayModeIncluded) { throw new RuntimeException("Default display mode is not included"); } } }
Example 17
Source File: X11GraphicsDevice.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 18
Source File: CheckDisplayModes.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice graphicDevice = ge.getDefaultScreenDevice(); if (!graphicDevice.isDisplayChangeSupported()) { System.err.println("Display mode change is not supported on this host. Test is considered passed."); return; } DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode(); checkDisplayMode(defaultDisplayMode); graphicDevice.setDisplayMode(defaultDisplayMode); DisplayMode[] displayModes = graphicDevice.getDisplayModes(); boolean isDefaultDisplayModeIncluded = false; for (DisplayMode displayMode : displayModes) { checkDisplayMode(displayMode); graphicDevice.setDisplayMode(displayMode); if (defaultDisplayMode.equals(displayMode)) { isDefaultDisplayModeIncluded = true; } } if (!isDefaultDisplayModeIncluded) { throw new RuntimeException("Default display mode is not included"); } }
Example 19
Source File: IncorrectDisplayModeExitFullscreen.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void main(final String[] args) { final GraphicsDevice[] devices = GraphicsEnvironment.getLocalGraphicsEnvironment() .getScreenDevices(); if (devices.length < 2 || devices[0].getDisplayModes().length < 2 || !devices[0].isFullScreenSupported() || !devices[1].isFullScreenSupported()) { System.err.println("Testcase is not applicable"); return; } final DisplayMode defaultDM = devices[0].getDisplayMode(); final DisplayMode[] dms = devices[0].getDisplayModes(); DisplayMode nonDefaultDM = null; for (final DisplayMode dm : dms) { if (!dm.equals(defaultDM)) { nonDefaultDM = dm; break; } } if (nonDefaultDM == null) { System.err.println("Testcase is not applicable"); return; } final Frame frame = new Frame(); frame.setBackground(Color.GREEN); frame.setUndecorated(true); try { devices[0].setFullScreenWindow(frame); sleep(); devices[0].setDisplayMode(nonDefaultDM); sleep(); devices[1].setFullScreenWindow(frame); sleep(); if (!defaultDM.equals(devices[0].getDisplayMode())) { throw new RuntimeException("DisplayMode is not restored"); } } finally { // cleaning up devices[0].setFullScreenWindow(null); devices[1].setFullScreenWindow(null); frame.dispose(); } }
Example 20
Source File: IncorrectDisplayModeExitFullscreen.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public static void main(final String[] args) { final GraphicsDevice[] devices = GraphicsEnvironment.getLocalGraphicsEnvironment() .getScreenDevices(); if (devices.length < 2 || devices[0].getDisplayModes().length < 2 || !devices[0].isFullScreenSupported() || !devices[1].isFullScreenSupported()) { System.err.println("Testcase is not applicable"); return; } final DisplayMode defaultDM = devices[0].getDisplayMode(); final DisplayMode[] dms = devices[0].getDisplayModes(); DisplayMode nonDefaultDM = null; for (final DisplayMode dm : dms) { if (!dm.equals(defaultDM)) { nonDefaultDM = dm; break; } } if (nonDefaultDM == null) { System.err.println("Testcase is not applicable"); return; } final Frame frame = new Frame(); frame.setBackground(Color.GREEN); frame.setUndecorated(true); try { devices[0].setFullScreenWindow(frame); sleep(); devices[0].setDisplayMode(nonDefaultDM); sleep(); devices[1].setFullScreenWindow(frame); sleep(); if (!defaultDM.equals(devices[0].getDisplayMode())) { throw new RuntimeException("DisplayMode is not restored"); } } finally { // cleaning up devices[0].setFullScreenWindow(null); devices[1].setFullScreenWindow(null); frame.dispose(); } }