Java Code Examples for java.awt.GraphicsDevice#getDisplayModes()
The following examples show how to use
java.awt.GraphicsDevice#getDisplayModes() .
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: 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 2
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 3
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 4
Source File: CheckDisplayModes.java From openjdk-jdk8u-backup 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 5
Source File: DisplayModeChanger.java From openjdk-jdk8u 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 6
Source File: DisplayModeChanger.java From jdk8u_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 7
Source File: CheckDisplayModes.java From openjdk-8 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 8
Source File: DisplayModeChanger.java From jdk8u60 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 9
Source File: CheckDisplayModes.java From jdk8u60 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 10
Source File: DisplayModeChanger.java From TencentKona-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 11
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 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: DisplayModeChanger.java From jdk8u-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 14
Source File: AltTabCrashTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }
Example 15
Source File: SettingsDialog.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Constructor for the <code>PropertiesDialog</code>. Creates a * properties dialog initialized for the primary display. * * @param source * the <code>GameSettings</code> object to use for working with * the properties file. * @param imageFile * the image file to use as the title of the dialog; * <code>null</code> will result in to image being displayed * @param mainThreadTasks * @throws JmeException * if the source is <code>null</code> */ public SettingsDialog(AppSettings source, URL imageFile, boolean loadSettings) { if (source == null) { throw new NullPointerException("Settings source cannot be null"); } this.source = source; this.imageFile = imageFile; // setModalityType(Dialog.ModalityType.APPLICATION_MODAL); setModal(true); AppSettings registrySettings = new AppSettings(true); String appTitle; if(source.getTitle()!=null){ appTitle = source.getTitle(); }else{ appTitle = registrySettings.getTitle(); } try { registrySettings.load(appTitle); } catch (BackingStoreException ex) { logger.log(Level.WARNING, "Failed to load settings", ex); } if (loadSettings) { source.copyFrom(registrySettings); } else if(!registrySettings.isEmpty()) { source.mergeFrom(registrySettings); } GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); modes = device.getDisplayModes(); Arrays.sort(modes, new DisplayModeSorter()); createUI(); }
Example 16
Source File: AltTabCrashTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }
Example 17
Source File: AltTabCrashTest.java From hottub with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }
Example 18
Source File: AltTabCrashTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }
Example 19
Source File: AltTabCrashTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }
Example 20
Source File: AltTabCrashTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }