I'm currently editing the library ControlP5 for Processing on Eclipse. The thing is that an unexpected error always comes out on the ControlWindow.java file:
The method .setBounds(int, int, int, int) is undefined for PApplet.
Here's the code of the method where the error occurs:
public ControlWindow setUndecorated( boolean theFlag ) {
if ( theFlag != isUndecorated( ) ) {
isUndecorated = theFlag;
_myApplet.frame.removeNotify( );
_myApplet.frame.setUndecorated( isUndecorated );
_myApplet.setSize( _myApplet.width , _myApplet.height );
_myApplet.setBounds( 0 , 0 , _myApplet.width , _myApplet.height );
_myApplet.frame.setSize( _myApplet.width , _myApplet.height );
_myApplet.frame.addNotify( );
}
return this;
}
The error means the PApplet
class doesn't contain this method, which is true if you are working with Processing 3.
setBounds()
is a method found in Processing 2; the PApplet class used to inherit this method from java.applet
, a class which it used to extend
. In Processing 3, PApplet moved away from the Java applet class, but the controlp5 source code is old and was built with Processing 2, not 3.
The
setBounds()
method specifies the size of the frame, and the location of the upper left corner.
... which is functionality covered by the setSize()
and setPosition()
methods, extant in Processing 3 (in fact the setUndecorated()
method in which the error is found already calls setSize()
).
So, remove the line to make the library compatible with Processing 3, or use Processing 2 instead.