java help
in
Programming Questions
•
3 years ago
Hi,
I have .NullPointerException error. I know whatss mean but I cant dinf any error on my code.
This is the code:
- class Scroll
- {
- float x ;
- float l ;
- Scroll()
- {
- x = 0;
- l = x+width;
- fill(127);
- stroke(255);
- rect(0,10,width,20);
- fill(255);
- stroke(0);
- rect(x,11,20,19);
- }
- void update()
- {
- if(mouseX < x)
- {
- l = width - x - mouseX;
- }
- else
- {
- l = width + x + mouseX;
- }
- x = mouseX;
- print(l);
- background(0);
- fill(127);
- stroke(255);
- rect(0,10,width,20);
- fill(255);
- stroke(0);
- rect(x,11,20,19);
- }
- }
1