Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
- Point p = yourAwtComponent.getLocationOnScreen();
- int w = yourAwtComponent.getWidth();
- int h = yourAwtComponent.getHeight();
- Rectangle rectangle = new Rectangle( p.x, p.y, w, h );
- Image image = robot.createScreenCapture(rectangle);
- ImageIO.write( image, "png", file );
- int width = frameContainer.getWidth();
- int height = frameContainer.getHeight();
- BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
- Graphics2D g2 = image.createGraphics();
- frameContainer.paint(g2);
- return image;
Add Comment
Please, Sign In to add comment