# Changing images with input key

**URL:** <https://discourse.processing.org/t/changing-images-with-input-key/14988>\
**Category:** Beginners\
**Created:** [October 28, 2019, 6:54pm UTC](https://discourse.processing.org/t/changing-images-with-input-key/14988 "2019-10-28T18:54:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kitty](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@Kitty](https://discourse.processing.org/u/Kitty)\
**Post date:** [October 28, 2019, 6:54pm UTC](https://discourse.processing.org/t/changing-images-with-input-key/14988/1 "2019-10-28T18:54:50Z")

</div>

I’m working with this java code and I would like to know how to change a displayed image with an input key. For example, change my currently display from im[0] to im[2]

---

<div class="post-metadata">

**Author:** ![Y4niS](https://avatars.discourse-cdn.com/v4/letter/y/a4c791/32.png) [@Y4niS](https://discourse.processing.org/u/Y4niS)\
**Post date:** [October 28, 2019, 8:29pm UTC](https://discourse.processing.org/t/changing-images-with-input-key/14988/2 "2019-10-28T20:29:34Z")

</div>

You should take a look at how the keyPressed() function works.  
[here](https://processing.org/reference/keyPressed_.html) is a reference.
