User Tools

Site Tools


properties_of_the_processing_window

Properties of the Processing Window

The Processing window is a PApplet, an extension of the Applet class. The complete documentation can be found at http://dev.processing.org/reference/core/javadoc/processing/core/PApplet.html

Window Size

There's a workaround to make the window the same size as the picture you're loading:

PImage myImage = loadImage("Image.jpg");
size(myImage.width, myImage.height);

image(myImage, 0,0);
...

It doesn't look like we can resize. There is a resize() function, but it only resizes the pixel map and not the actual window.

According to the documentation, the size() function: “Starts up and creates a two-dimensional drawing surface, or resizes the current drawing surface”. This only works as a bad hack, though: the window needs time to initialize (anywhere from 50 to 250 milliseconds). If you call size twice before then, it'll resize the window. Otherwise, it won't resize.

If you put it inside of a frame, you may be able to add a ResizeListener and resize the window, but it's a bit too complicated to be practical.

properties_of_the_processing_window.txt · Last modified: 2007/08/30 13:53 (external edit)