# How to minimize Processing Sketch window?

**URL:** https://discourse.processing.org/t/how-to-minimize-processing-sketch-window/35061
**Category:** Coding Questions
**Created:** [February 9, 2022, 5:21am UTC](https://discourse.processing.org/t/how-to-minimize-processing-sketch-window/35061 "2022-02-09T05:21:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![CaseyJ](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/caseyj/32/15118_2.png) [@CaseyJ](https://discourse.processing.org/u/CaseyJ)
#### Post date: [February 9, 2022, 5:21am UTC](https://discourse.processing.org/t/how-to-minimize-processing-sketch-window/35061/1 "2022-02-09T05:21:30Z")

</div>

Is there a way to run a line of code similar to exit(); that will minimize the window instead of closing it like exit(); does?

I need the window to go away so another can take its place. It just still needs to exist to listen for Arduino communication.

Thanks!

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [February 9, 2022, 6:56am UTC](https://discourse.processing.org/t/how-to-minimize-processing-sketch-window/35061/2 "2022-02-09T06:56:48Z")

</div>

frame.setExtendedState(JFrame.MAXIMIZED\_BOTH); frame.setVisible(true);

Try something like this

> <https://stackoverflow.com/questions/875132/how-to-call-setundecorated-after-a-frame-is-made-visible>

---

<div class="post-metadata">

### Author: ![m3mphis77](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@m3mphis77](https://discourse.processing.org/u/m3mphis77)
#### Post date: [July 18, 2022, 2:03am UTC](https://discourse.processing.org/t/how-to-minimize-processing-sketch-window/35061/3 "2022-07-18T02:03:06Z")

</div>

JFrame jframe = (JFrame)((processing.awt.PSurfaceAWT.SmoothCanvas)getSurface().getNative()).getFrame();  
jframe.setExtendedState(jframe.getExtendedState() | jframe.ICONIFIED);

---

<div class="post-metadata">

### Author: ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)
#### Post date: [July 18, 2022, 2:22am UTC](https://discourse.processing.org/t/how-to-minimize-processing-sketch-window/35061/4 "2022-07-18T02:22:55Z")

</div>

Works ok on my system. Thanks.
