Problem with Library Methods

Hi I’m trying to create a processing library using eclipse, everything Looks fine so far but if I use following Code for a class
package test;
import processing.core.*;
public class Testclass{
PAppplet parent;
Testclass(PApplet parent){
public float method1(float x){
return …;
public float method2(){
return …;

As I used the processing Code:

Import test.*;
Testclass x=new Testclass(this);

I got the Error
There is no Public method1 method in test.Testclass

If I registered method2 instead it works perfectly fine!

How do I fix this?

PS: I’m new to this forum, so I don’t know the Question Layout.

1 Like

The registered method cannot have parameters i.e. no float x.

1 Like

Is there a method wich makes it possible to do Register Methods with parameters?

Well, you could do this :

myFloatVar1 = 17;
public float myFloat() {
return myFloatVar1;

And in Processing :

println(x.myFloat()); //17

Basically using a global variable to cheat your access/use to/of the variable for the function.

1 Like

Could you please ahow a example of how you can use this to make method with parameters?

I am not sure why you are trying to register a method called method1. Can you explain because AFAIK registering a method with an arbitrary name is meaningless.

The registerMethod is used for two reasons

  1. provide user defined processing of mouse, key and touch events
  2. to provide methods to be called during Processing’s main execution thread e.g. pre, draw, post, dispose etc.

You can read about this here.


Thanks for this information I tried to make new commands using this method.
Do you know how you do this?

I assume by this you are trying to make “Processing commands” like fill(...), stroke(...) etc. again I would ask why you would want to do this.

Although in theory you could extend the PApplet class to provide additional methods but I would strongly recommend that you don’t even attempt it. The problems associated with doing this would make an angel cry :sob:


Ok I’ll try to avoiid that!