# The field PApplet.keyEvent is deprecated?

**URL:** <https://discourse.processing.org/t/the-field-papplet-keyevent-is-deprecated/42603>\
**Category:** Beginners\
**Created:** [August 16, 2023, 9:37pm UTC](https://discourse.processing.org/t/the-field-papplet-keyevent-is-deprecated/42603 "2023-08-16T21:37:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuhuhwy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/nuhuhwy/32/18485_2.png) [@nuhuhwy](https://discourse.processing.org/u/nuhuhwy)\
**Post date:** [August 16, 2023, 9:37pm UTC](https://discourse.processing.org/t/the-field-papplet-keyevent-is-deprecated/42603/1 "2023-08-16T21:37:06Z")

</div>

Does anybody know what this means?

 ![Screenshot_20230816_233604](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/a/5/a52bb7637a80bca600033efa59745331dc9955a9.png)

---

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [August 17, 2023, 5:12am UTC](https://discourse.processing.org/t/the-field-papplet-keyevent-is-deprecated/42603/2 "2023-08-17T05:12:12Z")

</div>

Hi @nuhuhwy,

it means, that the PApplet.keyevent class attribute is deprecated, resp. shouldn’t be used that way anymore.  
If you really want to use the keyEvent, you should call it like

```auto
void keyPressed(KeyEvent e) {
  println(e.getKeyCode());
}

```

or even easier just use …

```auto
void keyPressed() {
  if (key == ESC) {
    println("Escape pressed ("+keyCode+")!");
  }  
}

```

Cheers  
— mnse

> **[keyPressed() / Reference](https://processing.org/reference/keyPressed_.html)**
>
> The keyPressed() function is called once every time a key is pressed. The key that was pressed is stored in the key variable. For non-ASCII keys, use the keyCode varia…

---

<div class="post-metadata">

**Author:** ![nuhuhwy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/nuhuhwy/32/18485_2.png) [@nuhuhwy](https://discourse.processing.org/u/nuhuhwy)\
**Post date:** [August 21, 2023, 1:51pm UTC](https://discourse.processing.org/t/the-field-papplet-keyevent-is-deprecated/42603/3 "2023-08-21T13:51:21Z")

</div>

Im using this for a game which needs to use multiple keys at once, but this still helped! Thank you!

---

<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:** [August 21, 2023, 3:44pm UTC](https://discourse.processing.org/t/the-field-papplet-keyevent-is-deprecated/42603/4 "2023-08-21T15:44:01Z")

</div>

> [@nuhuhwy](#):
>
> … which needs to use multiple keys at once,

[Reddit.com/r/processing/comments/bshqa8/comment/eor5epo/](http://Reddit.com/r/processing/comments/bshqa8/comment/eor5epo/)

> **[Players Movement (Java) - GoToLoop - OpenProcessing](https://openprocessing.org/sketch/718355)**
>
> https://Reddit.com/r/processing/comments/bshqa8/how\_would\_i\_make\_a\_keypressed\_function\_support/eor5epo/
