How to center a sketch on the screen? Applies to Processing v3.x.
void setup() { size(640, 480); surface.setLocation((displayWidth-width)>>1, (displayHeight-height)>>1); }
To precisely center it, you have to take the frame size into account.
Tested up to: Processing v3.3.3.