No, I’m not talking about Christmas ornaments. I just came up with a quick hack to turn off the window frame from inside Processing. See this thread on the Processing forums to know why this is useful.
When running in the IDE the sketch runs as an applet, so it can’t use the “–present” command line switches available to applications because init() is called instead of main(). My hack simply overrides the default init(), sets the frame to be undecorated and then calls the regular PApplet.init().
Update: Setting the location of the window needs to happen in setup(), not init().
import processing.opengl.*;
void setup(){
size(400,400,OPENGL);
background(0);
frame.setLocation(0,0); // needs to be in setup(), not init()
}
void draw(){
stroke(255);
line(0,0,200,200);
}
public void init() {
frame.setUndecorated(true); // works.
// call PApplet.init() to take care of business
super.init();
}





main() is called after init(), which will reset any changes to the frame bounds. Instead, try moving
frame.setLocation(0,0);into setup().Thanks, Kyle, I’ve updated the code accordingly.
Ah, very handy that. Thanx.
Tried this in Eclipse, but to no result…
Unfortunately the applet won’t even initalize…
:-