Make window snap in to the borders

Is there a way to make the window snap in, so being fullscreen basically except for the taskbar?

void setup() {
  surface.setSize(300,300);
  surface.setResizable(true);
}

this does the trick!

2 Likes

I mean rather in a way that it snaps in on startup, instead of having to click the button of the window myself, is there a way to do that?

One step further, but now we have to discover how to place it top left on startup.

import java.awt.*;

void setup() {
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  int screenHeight = screenSize.height;
  int screenWidth = screenSize.width;
  surface.setSize(screenWidth, screenHeight);
  surface.setResizable(true);
}
2 Likes

Okay, that was easy. Just add:
surface.setLocation(0, 0);

1 Like

Processing has screenWidth and screenHeight variables built in as displayWidth and displayHeight:

void setup() {
  size(displayWidth, displayHeight);
  surface.setResizable(true);
}

@qewer3322
Thanks, thus they placed it again. It was considered deprecated before. See here.

1 Like