List of usage examples for java.awt GraphicsEnvironment getLocalGraphicsEnvironment
public static GraphicsEnvironment getLocalGraphicsEnvironment()
From source file:Main.java
public static boolean isTranslucentSupported() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); boolean isUniformTranslucencySupported = gd .isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT); return isUniformTranslucencySupported; }
From source file:Main.java
public static void centerWindow(Window w) { Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint(); centerWindow(w, center); }
From source file:Main.java
/** * centers the frame in the center of the screen * * @param pFrame Frame to center//from w w w . j av a2s . c o m */ static public void centerWindow(Window pFrame) { Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint(); center.x = center.x - (int) pFrame.getSize().getWidth() / 2; center.y = center.y - (int) pFrame.getSize().getHeight() / 2; pFrame.setLocation(center); }
From source file:Main.java
public static boolean isXOnScreen(int x) { GraphicsDevice[] devices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); for (GraphicsDevice device : devices) { int boundA = device.getDefaultConfiguration().getBounds().x; int boundB = boundA + device.getDefaultConfiguration().getBounds().width; if (inBounds(x, boundA, boundB)) { return true; }// w w w .j a va 2 s . c o m } return false; }
From source file:Main.java
public static boolean isYOnScreen(int y) { GraphicsDevice[] devices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); for (GraphicsDevice device : devices) { int boundA = device.getDefaultConfiguration().getBounds().y; int boundB = boundA + device.getDefaultConfiguration().getBounds().height; if (inBounds(y, boundA, boundB)) { return true; }/*from ww w. j a va 2 s. co m*/ } return false; }
From source file:Main.java
/** * Obtain the primary desktop bounds.// w w w. j a v a 2 s . c o m * * @return The primary desktop bounds <code>Rectangle</code>. */ public static Rectangle getPrimaryDesktopBounds() { return GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); }
From source file:Main.java
public static boolean isPointOnScreen(Point p) { GraphicsDevice[] devices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); for (GraphicsDevice device : devices) { if (device.getDefaultConfiguration().getBounds().contains(p)) { return true; }//from w w w . j av a2s . c o m } return false; }
From source file:Main.java
public static Rectangle computeVirtualGraphicsBounds() { Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); for (GraphicsDevice gd : gs) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); virtualBounds = virtualBounds.union(gc.getBounds()); }/*from w w w . j av a2s. com*/ return virtualBounds; }
From source file:Main.java
public static Rectangle getScreenSize(Window win) { Rectangle sb;//from w w w .ja v a2s . c o m if (win == null) { sb = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getDefaultConfiguration().getBounds(); } else { sb = win.getGraphicsConfiguration().getBounds(); } return sb; }
From source file:Main.java
public static Insets getScreenInsets(Window win) { Insets si;//ww w . ja v a 2s .com if (win == null) { si = Toolkit.getDefaultToolkit().getScreenInsets(GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice().getDefaultConfiguration()); } else { si = win.getToolkit().getScreenInsets(win.getGraphicsConfiguration()); } return si; }