Toggling fullscreen

Hello, i couldn’t find anything useful on the topic about toggling fullscreen (like F11 in browsers for example). Also how do i run a windowed sketch at the size of the screen? Because if I try this:

void setup(){

im getting an error.

Thanks in advance!

Hi @ripolas ,

Guess you are searching for that …

— mnse

no, sorry if i was not clear in the beggining. I meant that i wanna have like a button or somethign to trigger fullscreen then get back to windowed

Would something like this work? It uses windowResize(). Hit space bar to get full screen; hit some other key to reset.

final int _wndW = 400;
final int _wndH = 400;

void setup() {
  size(_wndW, _wndH);

void draw() {

void keyPressed() {
  if (key == 32) { // space bar
    windowResize(displayWidth, displayHeight);
  } else {
    windowResize(_wndW, _wndH);

1 Like

I tried replacing this with fullScreen() which doesn’t work.

fullScreen() does MORE than windowResize(displayWidth, displayHeight); since the position gets also changed.

Can we change the position to 0,0 ?

You might try the windowMove method.

1 Like

Can we change the position to 0,0 ?
setLocation() might work:

1 Like