# Help with error in Robot class and createScreenCapture() method

**URL:** <https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396>\
**Category:** Coding Questions\
**Created:** [May 31, 2021, 2:52pm UTC](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396 "2021-05-31T14:52:59Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![MoonAlien822](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Post date:** [May 31, 2021, 2:53pm UTC](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396/1 "2021-05-31T14:53:00Z")

</div>

PImage screenshot;  
import java.awt.Robot;

void setup() {  
size(400,300);  
}

void draw() {  
try {  
Robot robot = new Robot();  
screenshot = new PImage(robot.createScreenCapture(new Rectangle(0,0,screen.width,screen.height)));

```
 } catch (AWTException e) {
 }

```

image(screenshot, 0, 0, width, height);  
screenshot(0,0,width, height);  
}

this is the error:

The method createScreenCapture(java.awt.Rectangle) in the type Robot is not applicable for the arguments (Rectangle)

---

_[View the full topic](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396)._
