# How to disable window maximization

**URL:** <https://discourse.processing.org/t/how-to-disable-window-maximization/30713>\
**Category:** Beginners\
**Created:** [June 15, 2021, 1:18am UTC](https://discourse.processing.org/t/how-to-disable-window-maximization/30713 "2021-06-15T01:18:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![s31](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@s31](https://discourse.processing.org/u/s31)\
**Post date:** [June 15, 2021, 1:18am UTC](https://discourse.processing.org/t/how-to-disable-window-maximization/30713/1 "2021-06-15T01:18:51Z")

</div>

Hello,  
Every time I create a new processing sketch it adds a maximize screen button to the running window. I know its possible to just use

```auto
void draw(){
  surface.setSize(500,500);
}

```

to keep the window at a constant size, but I was wondering if there were any solutions that could remove the button entirely.  
Thanks.

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [June 15, 2021, 10:45pm UTC](https://discourse.processing.org/t/how-to-disable-window-maximization/30713/2 "2021-06-15T22:45:23Z")

</div>

[https://forum.processing.org/two/search?Search=setUndecorated](https://forum.processing.org/two/search?Search=setUndecorated)

---

<div class="post-metadata">

**Author:** ![th75](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@th75](https://discourse.processing.org/u/th75)\
**Post date:** [June 17, 2021, 11:05pm UTC](https://discourse.processing.org/t/how-to-disable-window-maximization/30713/3 "2021-06-17T23:05:45Z")

</div>

Hi,

i think frame.setUndecorated(true); works for processing 1.5.1 only (at least i didn t succed to apply it to surface)

a workaround (at least on mac) is:

```auto
int x = 0;

void setup() {
  fullScreen();
  surface.setResizable(true);
  surface.setSize(500,500);
  surface.setLocation(displayWidth/2-250, displayHeight/2-250);
  background(0);
  noStroke();
  fill(102);
}

void draw() {
  fill(color(random(255)));
  rect(x%500, height*0.2, 1, height*0.6); 
  x = x + 2;
}

```

but it s kind of weird, forcing fullscreen to avoid decoration then size down, and as it is not what those function was developped for, i can 't say if it works on other computers than mine…

---

<div class="post-metadata">

**Author:** ![Flolo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/flolo/32/13874_2.png) [@Flolo](https://discourse.processing.org/u/Flolo)\
**Post date:** [June 22, 2021, 3:44pm UTC](https://discourse.processing.org/t/how-to-disable-window-maximization/30713/4 "2021-06-22T15:44:18Z")

</div>

Hey, I don’t know if it’s the best solution, but it seems to work:

```auto
void setup() {
  //for the background color
  colorMode(HSB, 10000, 10000, 10000);
  //Fullscreen "disables" the button
  fullScreen(P2D);
  //sets the size 
  surface.setSize(600, 600);
  //And so that the window is not on the top left, we put it in the middle
  surface.setLocation(displayWidth/2-width/2, displayHeight/2-height/2);
}
void draw() {
  background(millis()%10000, 10000, 10000);
}

```

I hope I could help you 🙂

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [June 22, 2021, 4:38pm UTC](https://discourse.processing.org/t/how-to-disable-window-maximization/30713/5 "2021-06-22T16:38:52Z")

</div>

> [@th75](#):
>
> `surface.setResizable(true);`

Perhaps `surface.setResizable(false);` will handle the original question?!

Be careful using `fullScreen` - with different OS and different renderers it sets up different metadata on the window that might cause issues.

There are renderer specific ways to set undecorated if you get the native window and cast. eg. with `P2D` and `P3D`

```auto
import com.jogamp.newt.opengl.GLWindow;
...
GLWindow window = (GLWindow) surface.getNative();
window.setAlwaysOnTop(true);
window.setUndecorated(true);

```

---

<div class="post-metadata">

**Author:** ![th75](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@th75](https://discourse.processing.org/u/th75)\
**Post date:** [June 22, 2021, 8:52pm UTC](https://discourse.processing.org/t/how-to-disable-window-maximization/30713/6 "2021-06-22T20:52:36Z")

</div>

hi, neilcsmith

thanks for this surface.getnative(), i didn t know it

i m agree fullscreen is not best way  
but on macos, window.setUndecorated(true); make it crash, sadly

> [@neilcsmith](#):
>
> ```auto
> import com.jogamp.newt.opengl.GLWindow;
> ...
> GLWindow window = (GLWindow) surface.getNative();
> window.setAlwaysOnTop(true);
> window.setUndecorated(true);
> 
> ```
