[SOLVED] Class problem with ArrayList

Hi, I’m a beginner on Processing (thanks to Coding Train btw). I love it and I’ve just achieved a prog about the Fourier decomposition (3Blue1Brown’s videos are really inspiring). I want now to “draw” in this Fourier style. But I encountered an unexpected error : a problem of “unexisting class”. I can’t find the error so please be nice and help me !
My code :
First page

ArrayList<Circle> rain = new ArrayList<Circle>();

Second page

class Circle {
  float RADIUS_FIRST = 10;
  float RADIUS_AFTER = 32;
  float pos_x;
  float pos_y;
  float radius;
  
  Circle(){
    pos_x = 0;
    pos_y = 0;
    radius = RADIUS_FIRST;
  }
  
  Circle(float x_, float y_){
    radius = RADIUS_AFTER;
    pos_x = x_;
    pos_y = y_;
  }
  
  void display(){
   stroke(1);
   fill(0);
   ellipse(pos_x, pos_y, radius*2, radius*2); 
  }
}

What’s the problem here ? Because I verified the syntax on another program (Purple Rain code by Coding Train I think) and it seems to be the same, but…no. :sweat_smile:

1 Like

Processing.org/reference/setup_.html

1st tab:

final ArrayList<Circle> rain = new ArrayList<Circle>();

void setup() {
}

2nd tab:

class Circle {
}
2 Likes

So the only problem was that there wasn’t any void loop ?

Well, I don’t see neither setup() nor draw() callbacks in your posted code. :no_mouth:

Here’s an example sketch w/ a main tab file named “pjs-java.pde” w/ classes Ball & Chamber in their own corresponding “.pde” tab files: :cowboy_hat_face:

1 Like

Thanks !! Was about to go crazy !

1 Like

How am I supposed to put this subject as a “Solved” one ?

Hey There!

Unfortunately there’s not button (yet). What you can do is put it in the title.

2 Likes