Refine search
public static Rectangle[] getScreenBounds() { GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice[] screenDevices = graphicsEnvironment.getScreenDevices(); Rectangle[] screenBounds = new Rectangle[screenDevices.length]; for (int i = 0; i < screenDevices.length; i++) { GraphicsDevice screenDevice = screenDevices[i]; final GraphicsConfiguration defaultConfiguration = screenDevice.getDefaultConfiguration(); screenBounds[i] = defaultConfiguration.getBounds(); } return screenBounds; }
@Override public List<WebcamDevice> getDevices() { final GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice[] devices = environment.getScreenDevices(); final List<WebcamDevice> list = new ArrayList<>(devices.length); for (final GraphicsDevice device : devices) { list.add(new ScreenCaptureDevice(device)); } return list; }
@Override public DefaultRequest discoverParameters(GoogleAnalyticsConfig config, DefaultRequest request) { super.discoverParameters(config, request); Toolkit toolkit = Toolkit.getDefaultToolkit(); if (isEmpty(request.screenResolution())) { Dimension screenSize = toolkit.getScreenSize(); request.screenResolution(((int) screenSize.getWidth()) + "x" + ((int) screenSize.getHeight()) + ", " + toolkit.getScreenResolution() + " dpi"); } if (isEmpty(request.screenColors())) { GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] graphicsDevices = graphicsEnvironment.getScreenDevices(); StringBuilder sb = new StringBuilder(); for (GraphicsDevice graphicsDevice : graphicsDevices) { if (sb.length() != 0) { sb.append(", "); } sb.append(graphicsDevice.getDisplayMode().getBitDepth()); } request.screenColors(sb.toString()); } return request; } }
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); for (int j = 0; j < gs.length; j++) { GraphicsDevice gd = gs[j];
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); defDev = ge.getDefaultScreenDevice(); } catch (Throwable e1) { GraphicsDevice[] devs = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
GraphicsDevice defDev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); GraphicsDevice[] devs = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; public class TestHeadless { private static boolean isReallyHeadless() { if (GraphicsEnvironment.isHeadless()) { return true; } try { GraphicsDevice[] screenDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); return screenDevices == null || screenDevices.length == 0; } catch (HeadlessException e) { e.printStackTrace(); return true; } } }
/** * Returns the screen coordinates for the monitor that contains the * specified point. This is useful for setups with multiple monitors, * to ensure that popup windows are positioned properly. * * @param x The x-coordinate, in screen coordinates. * @param y The y-coordinate, in screen coordinates. * @return The bounds of the monitor that contains the specified point. */ public static Rectangle getScreenBoundsForPoint(int x, int y) { GraphicsEnvironment env = GraphicsEnvironment. getLocalGraphicsEnvironment(); GraphicsDevice[] devices = env.getScreenDevices(); for (int i=0; i<devices.length; i++) { GraphicsConfiguration[] configs = devices[i].getConfigurations(); for (int j=0; j<configs.length; j++) { Rectangle gcBounds = configs[j].getBounds(); if (gcBounds.contains(x, y)) { return gcBounds; } } } // If point is outside all monitors, default to default monitor (?) return env.getMaximumWindowBounds(); }
private int initMonitors() { if (!SX.isHeadless()) { genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); gdevs = genv.getScreenDevices(); nMonitors = gdevs.length; if (nMonitors == 0) {
GraphicsDevice[] gds = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); GraphicsDevice gd = null; int maxRes = Integer.MIN_VALUE; gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
/** * Returns the number of screens. * * @return the number of screens */ public static int getNumberOfScreens() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gd = ge.getScreenDevices(); return gd.length; }
@Override public void run() { GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); } };
public static int findScreenIndex(final GraphicsDevice awtDevice) { if(null==awtDevice) return -1; final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice[] gs = ge.getScreenDevices(); for (int j = 0; j < gs.length; j++) { if(gs[j] == awtDevice) return j; } return -1; }
/** * Gets all the screen devices. * * @return the screen devices */ public static GraphicsDevice[] getScreenDevices() { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice[] gs = ge.getScreenDevices(); return gs; }
public static GraphicsDevice getScreenDevice(final int index) { if(index<0) return null; final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice[] gs = ge.getScreenDevices(); if(index<gs.length) { return gs[index]; } return null; }
/** * Gets the available screens. * * @return the available screens */ public static GraphicsDevice[] getAvailableScreens() { final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment .getLocalGraphicsEnvironment(); final GraphicsDevice[] graphicsDevices = graphicsEnvironment.getScreenDevices(); return graphicsDevices; }
/******************************************************************************* * * ******************************************************************************/ public static GraphicsConfiguration getGraphicsConfiguration () { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); GraphicsDevice gd = gs[0]; // FIXME GraphicsConfiguration gc = gd.getDefaultConfiguration(); return gc; }
private static boolean isHeadless() { if (GraphicsEnvironment.isHeadless()) return true; try { GraphicsDevice[] screenDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); return screenDevices == null || screenDevices.length == 0; } catch (HeadlessException e) { return true; } }
@Nonnull public GraphicsDevice getGraphicsDevice() { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); return ge.getScreenDevices()[screenDeviceIndex]; } }
public List<Rectangle> getScreenBounds() { List<Rectangle> bounds = new ArrayList<>(25); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] lstGDs = ge.getScreenDevices(); for (GraphicsDevice gd : lstGDs) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle screenBounds = gc.getBounds(); bounds.add(screenBounds); } return bounds; }