0
votes

I am updating some old script to P3, there is a part where I want to scale the app window to a loaded image size.

As I am working in IntelliJ and so direct in Java I can not directly access surface. Anybody knows how I can call surface.setSize() in a Java Project?

1

1 Answers

0
votes

You can still get to the surface variable. Just call the getSurface() function of the PApplet class. If you're extending PApplet, you can just call it directly.

public class MySketch extends PApplet{

   public void mousePressed(){
      getSurface().setSize(200, 200);
   }

   // other functions

}

Also note that if you're loading the image at the beginning, you can just use the settings() function and call size() instead of going through the surface variable.