# Prevent Sketch from closing?

**URL:** https://discourse.processing.org/t/prevent-sketch-from-closing/6934
**Category:** Processing
**Created:** [December 27, 2018, 6:34pm UTC](https://discourse.processing.org/t/prevent-sketch-from-closing/6934 "2018-12-27T18:34:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Quillbert1](https://avatars.discourse-cdn.com/v4/letter/q/f475e1/32.png) [@Quillbert1](https://discourse.processing.org/u/Quillbert1)
#### Post date: [December 27, 2018, 6:34pm UTC](https://discourse.processing.org/t/prevent-sketch-from-closing/6934/1 "2018-12-27T18:34:05Z")

</div>

This is a bit of a weird one, but is there a way to stop a sketch from closing? I have found a way to prevent the escape key from closing the sketch, but is there a way to stop the x and double clicking the menu from closing the sketch?

---

<div class="post-metadata">

### Author: ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)
#### Post date: [December 28, 2018, 6:10pm UTC](https://discourse.processing.org/t/prevent-sketch-from-closing/6934/3 "2018-12-28T18:10:54Z")

</div>

Please don’t bump threads, especially after only waiting a few hours for a reply.

You might want to look into the `setUndecorated()` function.

But why do you want to do this?

---

<div class="post-metadata">

### Author: ![Quillbert1](https://avatars.discourse-cdn.com/v4/letter/q/f475e1/32.png) [@Quillbert1](https://discourse.processing.org/u/Quillbert1)
#### Post date: [December 28, 2018, 6:12pm UTC](https://discourse.processing.org/t/prevent-sketch-from-closing/6934/4 "2018-12-28T18:12:30Z")

</div>

I have an AI that learns to play a game, and I keep finding ways to close it accidentally. I want to make it so i can only close it through task manager.

---

<div class="post-metadata">

### Author: ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)
#### Post date: [December 28, 2018, 7:08pm UTC](https://discourse.processing.org/t/prevent-sketch-from-closing/6934/5 "2018-12-28T19:08:58Z")

</div>

Googling for “Processing setUndecorated” will return a ton of results. Or you could search this forum:

> [@Is setUndecorated() possible?](https://discourse.processing.org/t/is-setundecorated-possible/1097):
>
> I have 2 windows that I’m creating with the frames example of the controlP5 library. One works as the control window for sliders etc and the other the main sketch window where the artwork gets displayed. I have 2 monitors. Using fullScreen(2) runs the main sketch window as fullscreen. However, the control window is much smaller say size(400,800); I don’t want the title bar and close/minimize buttons at the top. Has setUndecorated() been completely removed in processing 3? If so how may I ac…

> [@Is it possible to not have the generic windows close buttons and make your own close button?](https://discourse.processing.org/t/is-it-possible-to-not-have-the-generic-windows-close-buttons-and-make-your-own-close-button/2013):
>
> So I’m talking about applications like discord, they don’t have that ugly windows border around their application, the league of legends client also doesn’t have it, Photoshop also has a custom one. So I know it’s possible but is it possible in processing? And if not, in what language would this be possible?
