# How do I switch between fullscreen and windowed during the sketch

**URL:** <https://discourse.processing.org/t/how-do-i-switch-between-fullscreen-and-windowed-during-the-sketch/13726>\
**Category:** Coding Questions\
**Created:** [August 31, 2019, 3:30pm UTC](https://discourse.processing.org/t/how-do-i-switch-between-fullscreen-and-windowed-during-the-sketch/13726 "2019-08-31T15:30:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lachieblue](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@Lachieblue](https://discourse.processing.org/u/Lachieblue)\
**Post date:** [August 31, 2019, 3:30pm UTC](https://discourse.processing.org/t/how-do-i-switch-between-fullscreen-and-windowed-during-the-sketch/13726/1 "2019-08-31T15:30:33Z")

</div>

So as the title says, I want to create a button or something that I can click during a sketch to resize the window from fullscreen to different windowed resolutions like in a game.

I’ve experimented with surface.setSize(), surface.setResizable(true) etc, but after a ton of googling I still can’t find a way to switch between windowed and fullscreen during the sketch.

Is this a limitation of Processing or am I just missing something here?

Any help is greatly appreciated

---

<div class="post-metadata">

**Author:** ![micycle](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micycle/32/201_2.png) [@micycle](https://discourse.processing.org/u/micycle)\
**Post date:** [August 31, 2019, 6:41pm UTC](https://discourse.processing.org/t/how-do-i-switch-between-fullscreen-and-windowed-during-the-sketch/13726/2 "2019-08-31T18:41:33Z")

</div>

In `FX2D` renderer mode…

First expose the JavaFX stage:

```auto
private final surface = (PSurfaceFX) getSurface();
private final canvas = (Canvas) surface.getNative();
private final stage = (Stage) canvas.getScene().getWindow();
stage.setFullScreenExitHint(""); // disable fullscreen toggle hint

```

Then use this code to toggle fullscreen:

```auto
noLoop();
stage.setFullScreen(!stage.isFullScreen());
loop();

```

_This is the approach we are using to toggle fullscreen in [this](https://github.com/Stephcraft/Project-16x16) open source Processing game._
