I have 2 tabs on my Processing program. I actually copied and pasted the exact code from a YouTube tutorial and keep getting the error message when I run.
Tab 1:
class Bubble {
float x;
float y;
Bubble (){
x=width/2;
y=height;
}
void ascend (){
y--;
}
void display() {
stroke(0);
fill(127);
ellipse(x,y,64,64);
}
}
Tab2:
Bubble b;
void setup() {
size(640,360);
b=new Bubble();
}
void draw () {
background(255);
b.ascend();
b.display();
//b.top();
}
The error message says that:
Syntax error on token "class", Identifier expected
Processing functions like setup()
and draw()
need to be in the first tab.
I'm not totally sure why this is. It shouldn't be strictly necessary because all of the tabs get converted into one Java file, unless your tab names ends with .java
. My guess is this is a quirk of the Processing -> Java compiler.
You could file a bug on the Processing GitHub repo, but I think your best bet is to make sure all your Processing functions are in the first tab.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments