Java Code Examples for java.awt.Component#getGraphicsConfiguration()
The following examples show how to use
java.awt.Component#getGraphicsConfiguration() .
These examples are extracted from open source projects.
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 Project: cropplanning File: AquaLnFPopupLocationFix.java License: GNU General Public License v3.0 | 6 votes |
/** * Get the best graphics configuration for the specified point and component. */ private GraphicsConfiguration graphicsConfigurationForComponent(Component component) { Point point = component.getLocationOnScreen(); // try to find the graphics configuration for our point of interest GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gd = ge.getScreenDevices(); for(int i = 0; i < gd.length; i++) { if(gd[i].getType() != GraphicsDevice.TYPE_RASTER_SCREEN) continue; GraphicsConfiguration defaultGraphicsConfiguration = gd[i].getDefaultConfiguration(); if(!defaultGraphicsConfiguration.getBounds().contains(point)) continue; return defaultGraphicsConfiguration; } // we couldn't find a graphics configuration, use the component's return component.getGraphicsConfiguration(); }
Example 2
Source Project: dragonwell8_jdk File: Destinations.java License: GNU General Public License v2.0 | 5 votes |
public void setDestination(TestEnvironment env) { Component c = env.getCanvas(); GraphicsConfiguration gc = c.getGraphicsConfiguration(); int w = env.getWidth(); int h = env.getHeight(); if (transparency == 0) { env.setTestImage(gc.createCompatibleImage(w, h)); } else { env.setTestImage(gc.createCompatibleImage(w, h, transparency)); } }
Example 3
Source Project: jdk8u-jdk File: Destinations.java License: GNU General Public License v2.0 | 5 votes |
public void setDestination(TestEnvironment env) { Component c = env.getCanvas(); GraphicsConfiguration gc = c.getGraphicsConfiguration(); int w = env.getWidth(); int h = env.getHeight(); if (transparency == 0) { env.setTestImage(gc.createCompatibleImage(w, h)); } else { env.setTestImage(gc.createCompatibleImage(w, h, transparency)); } }
Example 4
Source Project: jdk8u60 File: Destinations.java License: GNU General Public License v2.0 | 5 votes |
public void setDestination(TestEnvironment env) { Component c = env.getCanvas(); GraphicsConfiguration gc = c.getGraphicsConfiguration(); int w = env.getWidth(); int h = env.getHeight(); if (transparency == 0) { env.setTestImage(gc.createCompatibleImage(w, h)); } else { env.setTestImage(gc.createCompatibleImage(w, h, transparency)); } }
Example 5
Source Project: openjdk-jdk8u File: Destinations.java License: GNU General Public License v2.0 | 5 votes |
public void setDestination(TestEnvironment env) { Component c = env.getCanvas(); GraphicsConfiguration gc = c.getGraphicsConfiguration(); int w = env.getWidth(); int h = env.getHeight(); if (transparency == 0) { env.setTestImage(gc.createCompatibleImage(w, h)); } else { env.setTestImage(gc.createCompatibleImage(w, h, transparency)); } }
Example 6
Source Project: jdk8u-dev-jdk File: Destinations.java License: GNU General Public License v2.0 | 5 votes |
public void setDestination(TestEnvironment env) { Component c = env.getCanvas(); GraphicsConfiguration gc = c.getGraphicsConfiguration(); int w = env.getWidth(); int h = env.getHeight(); if (transparency == 0) { env.setTestImage(gc.createCompatibleImage(w, h)); } else { env.setTestImage(gc.createCompatibleImage(w, h, transparency)); } }
Example 7
Source Project: openjdk-jdk9 File: Destinations.java License: GNU General Public License v2.0 | 5 votes |
public void setDestination(TestEnvironment env) { Component c = env.getCanvas(); GraphicsConfiguration gc = c.getGraphicsConfiguration(); int w = env.getWidth(); int h = env.getHeight(); if (transparency == 0) { env.setTestImage(gc.createCompatibleImage(w, h)); } else { env.setTestImage(gc.createCompatibleImage(w, h, transparency)); } }
Example 8
Source Project: openjdk-jdk9 File: Destinations.java License: GNU General Public License v2.0 | 5 votes |
public void setDestination(final TestEnvironment env) { Component c = env.getCanvas(); GraphicsConfiguration gc = c.getGraphicsConfiguration(); int w = env.getWidth(); int h = env.getHeight(); if (transparency == 0) { env.setTestImage(gc.createCompatibleVolatileImage(w, h)); } else { env.setTestImage(gc.createCompatibleVolatileImage(w, h, transparency)); } }
Example 9
Source Project: rapidminer-studio File: AbstractCachedPainter.java License: GNU Affero General Public License v3.0 | 5 votes |
public void paint(Component c, Graphics g, int x, int y, int w, int h, Object[] args) { if (w <= 0 || h <= 0) { return; } Object key = getClass(); GraphicsConfiguration config = c.getGraphicsConfiguration(); Cache cache = getCache(key); Image image = cache.getImage(key, config, w, h, args); int attempts = 0; do { boolean draw = false; if (image instanceof VolatileImage) { switch (((VolatileImage) image).validate(config)) { case VolatileImage.IMAGE_INCOMPATIBLE: ((VolatileImage) image).flush(); image = null; break; case VolatileImage.IMAGE_RESTORED: draw = true; break; } } if (image == null) { image = createImage(c, w, h, config); cache.setImage(key, config, w, h, args, image); draw = true; } if (draw) { Graphics g2 = image.getGraphics(); paintToImage(c, g2, w, h, args); g2.dispose(); } paintImage(c, g, x, y, w, h, image, args); } while (image instanceof VolatileImage && ((VolatileImage) image).contentsLost() && ++attempts < 3); }
Example 10
Source Project: Pixie File: ScreenResolution.java License: MIT License | 5 votes |
/** * Constructor where the resolution is computed. * * @param comp - the frame of the gui - needed to get the resolution of the screen where the app is showed */ public ScreenResolution(Component comp) { //set the current screen resolution GraphicsConfiguration graphicsCfg = comp.getGraphicsConfiguration(); DisplayMode displayMode = graphicsCfg.getDevice().getDisplayMode(); resolution = new Dimension(displayMode.getWidth(), displayMode.getHeight()); }
Example 11
Source Project: openjdk-8 File: Destinations.java License: GNU General Public License v2.0 | 5 votes |
public void setDestination(TestEnvironment env) { Component c = env.getCanvas(); GraphicsConfiguration gc = c.getGraphicsConfiguration(); int w = env.getWidth(); int h = env.getHeight(); if (transparency == 0) { env.setTestImage(gc.createCompatibleImage(w, h)); } else { env.setTestImage(gc.createCompatibleImage(w, h, transparency)); } }
Example 12
Source Project: jdk8u_jdk File: SunVolatileImage.java License: GNU General Public License v2.0 | 4 votes |
public SunVolatileImage(Component comp, int width, int height, Object context) { this(comp, comp.getGraphicsConfiguration(), width, height, context, null); }
Example 13
Source Project: jdk8u-jdk File: SunVolatileImage.java License: GNU General Public License v2.0 | 4 votes |
public SunVolatileImage(Component comp, int width, int height, Object context) { this(comp, comp.getGraphicsConfiguration(), width, height, context, null); }
Example 14
Source Project: openjdk-jdk8u File: SunVolatileImage.java License: GNU General Public License v2.0 | 4 votes |
public SunVolatileImage(Component comp, int width, int height, Object context) { this(comp, comp.getGraphicsConfiguration(), width, height, context, null); }
Example 15
Source Project: openjdk-jdk8u-backup File: SunVolatileImage.java License: GNU General Public License v2.0 | 4 votes |
public SunVolatileImage(Component comp, int width, int height, Object context) { this(comp, comp.getGraphicsConfiguration(), width, height, context, null); }
Example 16
Source Project: openjdk-8-source File: SunVolatileImage.java License: GNU General Public License v2.0 | 4 votes |
public SunVolatileImage(Component comp, int width, int height, Object context) { this(comp, comp.getGraphicsConfiguration(), width, height, context, null); }
Example 17
Source Project: openjdk-8 File: SunVolatileImage.java License: GNU General Public License v2.0 | 4 votes |
public SunVolatileImage(Component comp, int width, int height, Object context) { this(comp, comp.getGraphicsConfiguration(), width, height, context, null); }
Example 18
Source Project: openjdk-jdk9 File: SunVolatileImage.java License: GNU General Public License v2.0 | 4 votes |
public SunVolatileImage(Component comp, int width, int height, Object context) { this(comp, comp.getGraphicsConfiguration(), width, height, context, null); }
Example 19
Source Project: jdk8u-jdk File: SunVolatileImage.java License: GNU General Public License v2.0 | 4 votes |
public SunVolatileImage(Component comp, int width, int height, Object context) { this(comp, comp.getGraphicsConfiguration(), width, height, context, null); }
Example 20
Source Project: Pixie File: ScreenResolution.java License: MIT License | 4 votes |
/** * Saves the resolution of the screen where the component is showed. * * @param comp - the frame for which the resolution of the containing screen is needed */ public void setScreenResolution(Component comp) { GraphicsConfiguration graphicsCfg = comp.getGraphicsConfiguration(); DisplayMode displayMode = graphicsCfg.getDevice().getDisplayMode(); resolution = new Dimension(displayMode.getWidth(), displayMode.getHeight()); }