Java Code Examples for java.awt.Frame#getGraphicsConfiguration()
The following examples show how to use
java.awt.Frame#getGraphicsConfiguration() .
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: Utilities.java From netbeans with Apache License 2.0 | 6 votes |
/** * Finds out the monitor where the user currently has the input focus. * This method is usually used to help the client code to figure out on * which monitor it should place newly created windows/frames/dialogs. * * @return the GraphicsConfiguration of the monitor which currently has the * input focus */ private static GraphicsConfiguration getCurrentGraphicsConfiguration() { Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (focusOwner != null) { Window w = SwingUtilities.getWindowAncestor(focusOwner); if (w != null) { return w.getGraphicsConfiguration(); } else { //#217737 - try to find the main window which could be placed in secondary screen for( Frame f : Frame.getFrames() ) { if( "NbMainWindow".equals(f.getName())) { //NOI18N return f.getGraphicsConfiguration(); } } } } return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); }
Example 2
Source File: BETitlePane.java From beautyeye with Apache License 2.0 | 5 votes |
/** * 设置窗口的最大边界. * <p> * 本方法由Jack Jiang 于2012-09-20添加的。 * * @param f the new frame max bound * @see org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper#setMaximizedBoundForFrame * @since 3.2 */ private void setFrameMaxBound(Frame f) { GraphicsConfiguration gc = f.getGraphicsConfiguration(); Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc); Rectangle screenBounds = gc.getBounds(); int x = Math.max(0, screenInsets.left); int y = Math.max(0, screenInsets.top); int w = screenBounds.width - (screenInsets.left + screenInsets.right); int h = screenBounds.height - (screenInsets.top + screenInsets.bottom); // Keep taskbar visible f.setMaximizedBounds(new Rectangle(x, y, w, h)); }
Example 3
Source File: DrawImageBilinear.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 4
Source File: DrawImageBilinear.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 5
Source File: DrawImageBilinear.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 6
Source File: DrawImageBilinear.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 7
Source File: DrawImageBilinear.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 8
Source File: DrawImageBilinear.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 9
Source File: DrawImageBilinear.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 10
Source File: DrawImageBilinear.java From hottub with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 11
Source File: DrawImageBilinear.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 12
Source File: DrawImageBilinear.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 13
Source File: DrawImageBilinear.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 14
Source File: DrawImageBilinear.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }
Example 15
Source File: DrawImageBilinear.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) { boolean show = false; for (String arg : args) { if ("-show".equals(arg)) { show = true; } } String arch = System.getProperty("os.arch"); boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl"); skipOglTextureTest = isOglEnabled && ("sparc".equals(arch)); System.out.println("Skip OpenGL texture test: " + skipOglTextureTest); DrawImageBilinear test = new DrawImageBilinear(); Frame frame = new Frame(); frame.add(test); frame.pack(); frame.setVisible(true); // Wait until the component's been painted synchronized (test) { while (!done) { try { test.wait(); } catch (InterruptedException e) { throw new RuntimeException("Failed: Interrupted"); } } } GraphicsConfiguration gc = frame.getGraphicsConfiguration(); if (gc.getColorModel() instanceof IndexColorModel) { System.out.println("IndexColorModel detected: " + "test considered PASSED"); frame.dispose(); return; } if (!show) { frame.dispose(); } if (capture == null) { throw new RuntimeException("Failed: capture is null"); } // Test background color int pixel = capture.getRGB(5, 5); if (pixel != 0xffffffff) { throw new RuntimeException("Failed: Incorrect color for " + "background"); } // Test pixels testRegion(capture, new Rectangle(10, 10, 40, 40)); testRegion(capture, new Rectangle(80, 10, 40, 40)); testRegion(capture, new Rectangle(150, 10, 40, 40)); }