List of usage examples for java.awt Rectangle Rectangle
public Rectangle(Dimension d)
From source file:de.mycrobase.jcloudapp.Main.java
private BufferedImage takeScreenshot() { try {/*from ww w . ja va 2s . co m*/ Robot robot = new Robot(); Rectangle captureSize = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); return robot.createScreenCapture(captureSize); } catch (AWTException ex) { System.out.println(ex); } return null; }
From source file:edu.ku.brc.specify.ui.containers.ContainerTreeRenderer.java
/** * @return the hitRects// w ww. j a va 2s. c o m */ public Rectangle[] getHitRects() { Rectangle[] rects = new Rectangle[hitRects.length]; for (int i = 0; i < rects.length; i++) { rects[i] = new Rectangle(hitRects[i]); } return rects; }
From source file:PNGDecoder.java
/** Static method performing whole screen capture into PNG image format file with given fileName. * @param fileName String image target filename * @param mode image color mode */ public static void captureScreen(String fileName, byte mode) { captureScreen(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()), fileName, mode); }
From source file:com.cisco.dbds.utils.selenium.SeleniumUtilities.java
/** * This function captures the Screenshot of the screen and converts it into * a byte array to embed in cucumber reports. * //ww w . jav a2s .c om * @return the byte[] * @throws Exception * the exception */ public static byte[] captureScreen() throws Exception { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Rectangle screenRectangle = new Rectangle(screenSize); Robot robot = new Robot(); BufferedImage image = robot.createScreenCapture(screenRectangle); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(image, "png", baos); baos.flush(); byte[] bytes = baos.toByteArray(); baos.close(); return bytes; }