# How to move the mouse by code

**URL:** <https://discourse.processing.org/t/how-to-move-the-mouse-by-code/20376>\
**Category:** Coding Questions\
**Created:** [May 2, 2020, 4:53am UTC](https://discourse.processing.org/t/how-to-move-the-mouse-by-code/20376 "2020-05-02T04:53:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![emanresU](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@emanresU](https://discourse.processing.org/u/emanresU)\
**Post date:** [May 2, 2020, 4:53am UTC](https://discourse.processing.org/t/how-to-move-the-mouse-by-code/20376/1 "2020-05-02T04:53:33Z")

</div>

how i can move the mouse by code in to the center of the display (window) like in 3d games where it uses for rotate the camera (i know inglish very well)

---

<div class="post-metadata">

**Author:** ![Java.SourceForger](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/java.sourceforger/32/9831_2.png) [@Java.SourceForger](https://discourse.processing.org/u/Java.SourceForger)\
**Post date:** [May 2, 2020, 6:05am UTC](https://discourse.processing.org/t/how-to-move-the-mouse-by-code/20376/2 "2020-05-02T06:05:51Z")

</div>

You need to use the java robot class: ([Docs.oracle.com](https://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html#mouseMove(int,%20int)))
