# How do I maximize the sketch window?

**URL:** <https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620>\
**Category:** Coding Questions\
**Created:** [May 26, 2019, 10:35pm UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620 "2019-05-26T22:35:16Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![notcatfish2017](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@notcatfish2017](https://discourse.processing.org/u/notcatfish2017)\
**Post date:** [May 26, 2019, 10:35pm UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/1 "2019-05-26T22:35:16Z")

</div>

Hi,

How do I maximize the sketch window? (not fullscreen)

Thanks!

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [May 27, 2019, 1:05am UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/2 "2019-05-27T01:05:09Z")

</div>

first step would be to enable the window max

```auto
void setup() {
  surface.setResizable(true);
  //fullScreen();
}

```

after that can try like

```auto
boolean Run_Once = true;

void setup() {
  surface.setResizable(true);
  //fullScreen();
}
void draw() {
  if (Run_Once) {
    javax.swing.JFrame jframe = (javax.swing.JFrame)((processing.awt.PSurfaceAWT.SmoothCanvas)getSurface().getNative()).getFrame();
    Run_Once = false;
    jframe.setLocation(0, 0);
    jframe.setExtendedState(jframe.getExtendedState() | jframe.MAXIMIZED_BOTH);
  }
}

```

---

<div class="post-metadata">

**Author:** ![notcatfish2017](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@notcatfish2017](https://discourse.processing.org/u/notcatfish2017)\
**Post date:** [May 30, 2019, 1:50am UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/3 "2019-05-30T01:50:25Z")

</div>

If I use

`jframe.setExtendedState(jframe.getExtendedState() | jframe.MAXIMIZED_BOTH);`

The window will actually be a bit taller than the normal maximized height and I don’t know how to fix that.

![](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/09fcf83521bff0451b30817decd702cfb9de5d2a.png)

This screenshot is taken from the very top right corner of the screen. As you can see, it is taller than my screen.

---

<div class="post-metadata">

**Author:** ![notcatfish2017](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@notcatfish2017](https://discourse.processing.org/u/notcatfish2017)\
**Post date:** [December 10, 2019, 2:29am UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/4 "2019-12-10T02:29:37Z")

</div>

Wow, it’s been 6 months! I’m still not able to solve this issue! 😮

Also, in the original post I forgot to mention that the window isn’t even maximized. You can tell from the screenshot that the middle icon is still a rectangle instead of 2.

Any help will be appreciated!

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [December 10, 2019, 4:44am UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/5 "2019-12-10T04:44:54Z")

</div>

Try going with screen.width and screen.height as the variables for size(). It works on IOS and apparently was once a valid way for processing, but it‘s long ago, so i don‘t know if it‘s still good.

---

<div class="post-metadata">

**Author:** ![notcatfish2017](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@notcatfish2017](https://discourse.processing.org/u/notcatfish2017)\
**Post date:** [December 10, 2019, 4:52am UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/7 "2019-12-10T04:52:18Z")

</div>

I don’t think this method exists

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [December 10, 2019, 5:07am UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/8 "2019-12-10T05:07:40Z")

</div>

Indeed, Google led me on the wrong track 😅 .

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 10, 2019, 5:39am UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/9 "2019-12-10T05:39:55Z")

</div>

Hello,

Try this:

```auto
void settings()
  {
  size(displayWidth, displayHeight);  
  }

void setup()
 {
 }

void draw() 
  {
  background(0);
  }

```

Or::

```auto
import java.awt.*;

void settings()
  {
  Toolkit toolkit=Toolkit.getDefaultToolkit();
  int width = toolkit.getScreenSize().width;
  int height =toolkit.getScreenSize().height;
  println(width, height);

  size(width, height);  
  }

void setup()
 {
 }

void draw() 
  {
  background(0);
  }

```

References:

> **[Get Screen Size and Resolution in Java](http://java-demos.blogspot.com/2012/11/get-screen-size-and-resolution-in-java.html)**
>
> An example on getting and printing screen size and resolution (dots per pixel) in Java.

  
[https://processing.org/reference/size\_.html](https://processing.org/reference/size_.html)  
[https://processing.org/reference/settings\_.html](https://processing.org/reference/settings_.html)

🙂

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 10, 2019, 5:46am UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/10 "2019-12-10T05:46:35Z")

</div>

> [@Lexyth](#):
>
> Try going with screen.width and screen.height as the variables for size(). It works on IOS and apparently was once a valid way for processing, but it‘s long ago, so i don‘t know if it‘s still good.

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8aeb418cc3ce8d28861963fd2656e760f982974c.png)

🙂

---

<div class="post-metadata">

**Author:** ![notcatfish2017](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@notcatfish2017](https://discourse.processing.org/u/notcatfish2017)\
**Post date:** [December 10, 2019, 5:46am UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/11 "2019-12-10T05:46:57Z")

</div>

> [@glv](#):
>
> Toolkit

This isn’t exactly what I was looking for. Your code does set the size of the window to be the size of a maximized window, but the window itself isn’t maximized. It still is in a windowed state. You can easily see this by looking at the icons on the top right. When it is actually maximized, the middle icon should show 2 rectangles like so:

[![](https://cf.ydcdn.net/latest/images/computer/_MAXMIZ7.GIF) ](https://cf.ydcdn.net/latest/images/computer/_MAXMIZ7.GIF)

I hope you understand what I mean by now. Thanks for the reply though.

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [December 10, 2019, 2:15pm UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/12 "2019-12-10T14:15:36Z")

</div>

@glv yes, i though they were different 😅 but on the IOS version it still worked, so i just assumed it to be the same, since i don‘t really use displayWidth with the IDE.

As for @notcatfish2017 , there is no other way to set a window to be maximized available. At least not as far as i know, since that already is the way to maximize a window. (That with .Maximize\_Both). Try maximizing it manually, maybe that is just the way this window maximizes… happens to me sometimes, so…

Or you can try to set the position of the sketch to not be 0,0 , but instead 5, 5. Maybe that works out.

---

<div class="post-metadata">

**Author:** ![notcatfish2017](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@notcatfish2017](https://discourse.processing.org/u/notcatfish2017)\
**Post date:** [December 10, 2019, 7:26pm UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/13 "2019-12-10T19:26:58Z")

</div>

I guess the only way to maximize a window is to do so manually. 😞

---

<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:** [July 31, 2020, 4:00am UTC](https://discourse.processing.org/t/how-do-i-maximize-the-sketch-window/11620/14 "2020-07-31T04:00:11Z")

</div>

I don’t know but maybe you can send keycode to the window like Alt-Space and x
