Java Code Examples for java.awt.DisplayMode#getWidth()
The following examples show how to use
java.awt.DisplayMode#getWidth() .
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: 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 2
Source File: Win32GraphicsDevice.java From jdk8u_jdk 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 3
Source File: X11GraphicsDevice.java From jdk8u60 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 4
Source File: SplashScreen.java From freecol with GNU General Public License v2.0 | 6 votes |
/** * Initialize the splash screen. * * @param gd The {@code GraphicsDevice} to display on. * @param splashStream An {@code InputStream} to read content from. */ public SplashScreen(GraphicsDevice gd, InputStream splashStream) throws IOException { super(gd.getDefaultConfiguration()); BufferedImage im = ImageIO.read(splashStream); this.getContentPane().add(new JLabel(new ImageIcon(im))); this.pack(); this.setVisible(false); Point start = this.getLocation(); DisplayMode dm = gd.getDisplayMode(); int x = start.x + dm.getWidth()/2 - this.getWidth() / 2; int y = start.y + dm.getHeight()/2 - this.getHeight() / 2; this.setLocation(x, y); }
Example 5
Source File: Win32GraphicsDevice.java From jdk8u60 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 6
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 7
Source File: FullScreenInsets.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void testWindowBounds(final DisplayMode dm, final Window w) { if (w.getWidth() != dm.getWidth() || w.getHeight() != dm.getHeight()) { System.err.println(" Wrong window bounds:" + " Expected: width = " + dm.getWidth() + ", height = " + dm.getHeight() + " Actual: " + w.getSize()); passed = false; } }
Example 8
Source File: FullScreenInsets.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void testWindowBounds(final DisplayMode dm, final Window w) { if (w.getWidth() != dm.getWidth() || w.getHeight() != dm.getHeight()) { System.err.println(" Wrong window bounds:" + " Expected: width = " + dm.getWidth() + ", height = " + dm.getHeight() + " Actual: " + w.getSize()); passed = false; } }
Example 9
Source File: FullScreenInsets.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void testWindowBounds(final DisplayMode dm, final Window w) { if (w.getWidth() != dm.getWidth() || w.getHeight() != dm.getHeight()) { System.err.println(" Wrong window bounds:" + " Expected: width = " + dm.getWidth() + ", height = " + dm.getHeight() + " Actual: " + w.getSize()); passed = false; } }
Example 10
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 11
Source File: AltTabCrashTest.java From openjdk-jdk8u 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 12
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 13
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 14
Source File: CheckDisplayModes.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
static void checkDisplayMode(DisplayMode displayMode) { if (displayMode == null || displayMode.getWidth() <= 1 || displayMode.getHeight() <= 1) { throw new RuntimeException("invalid display mode"); } }
Example 15
Source File: CheckDisplayModes.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
static void checkDisplayMode(DisplayMode displayMode) { if (displayMode == null || displayMode.getWidth() <= 1 || displayMode.getHeight() <= 1) { throw new RuntimeException("invalid display mode"); } }
Example 16
Source File: CheckDisplayModes.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
static void checkDisplayMode(DisplayMode displayMode) { if (displayMode == null || displayMode.getWidth() <= 1 || displayMode.getHeight() <= 1) { throw new RuntimeException("invalid display mode"); } }
Example 17
Source File: NonExistentDisplayModeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static DisplayMode deriveSize(DisplayMode dm) { int w = dm.getWidth() / 7; int h = dm.getHeight() / 3; return new DisplayMode(w, h, dm.getBitDepth(), dm.getRefreshRate()); }
Example 18
Source File: CheckDisplayModes.java From hottub with GNU General Public License v2.0 | 4 votes |
static void checkDisplayMode(DisplayMode displayMode) { if (displayMode == null || displayMode.getWidth() <= 1 || displayMode.getHeight() <= 1) { throw new RuntimeException("invalid display mode"); } }
Example 19
Source File: CheckDisplayModes.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
static void checkDisplayMode(DisplayMode displayMode) { if (displayMode == null || displayMode.getWidth() <= 1 || displayMode.getHeight() <= 1) { throw new RuntimeException("invalid display mode"); } }
Example 20
Source File: NonExistentDisplayModeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static DisplayMode deriveRR(DisplayMode dm) { return new DisplayMode(dm.getWidth(), dm.getHeight(), dm.getBitDepth(), 777); }