# 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:** 6\
**Page:** 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)

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [May 31, 2021, 3:07pm UTC](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396/2 "2021-05-31T15:07:28Z")

</div>

Hello,

Please format your code:  
_[FAQ - Processing Foundation](https://discourse.processing.org/faq#format-your-code)_

Here is a working example:  
_[http://www.magicandlove.com/blog/2016/12/16/screen-capture-in-processing/](http://www.magicandlove.com/blog/2016/12/16/screen-capture-in-processing/)_

Subject is much too long and could be shortened from:

> Why does my program return the error, The method createScreenCapture(java.awt.Rectangle) in the type Robot is not applicable for the arguments (Rectangle)?

To:

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

Or similar…

And then more details in the body of topic.

`:)`

---

<div class="post-metadata">

**Author:** ![debxyz](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@debxyz](https://discourse.processing.org/u/debxyz)\
**Post date:** [May 31, 2021, 4:04pm UTC](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396/4 "2021-05-31T16:04:23Z")

</div>

Hello @MoonAlien822

Not to get too into the weeds on this, but… 🙃

one of the important things about topic titles is that they include “searchable” keywords so that others who may have a similar question at a later date can find previous topics in the database of topics.

It saves time for people seeking answers as well as those providing answers.

Your topic line is now super generic and not really findable for others. GLV’s suggested topic line uses relevant keywords and is therefore findable.  
Just something to keep in mind going forward…  
🤓

---

<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, 4:05pm UTC](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396/5 "2021-05-31T16:05:39Z")

</div>

i had this at first but there was another answer saying that it was too long.

---

<div class="post-metadata">

**Author:** ![debxyz](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@debxyz](https://discourse.processing.org/u/debxyz)\
**Post date:** [May 31, 2021, 4:24pm UTC](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396/6 "2021-05-31T16:24:09Z")

</div>

Yes. Your original title WAS too long. I was directing you to GLVs suggested shorter title that includes the relevant keywords here:

> [@glv](#):
>
> > Help with error in Robot class and createScreenCapture() method

EDIT: Ok, I see it is now changed. 🙂

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 1, 2021, 11:22am UTC](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396/7 "2021-06-01T11:22:25Z")

</div>

[forum.Processing.org/two/discussion/8025/take-a-screen-shot-of-the-screen#Item\_8](http://forum.Processing.org/two/discussion/8025/take-a-screen-shot-of-the-screen#Item_8)
