We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Error code with java.awt.Component
Page Index Toggle Pages: 1
Error code with java.awt.Component (Read 324 times)
Error code with java.awt.Component
May 18th, 2007, 12:00pm
 
I got a problem in compiling, and had found the trouble shooting but find nothing.

The computer i used is for Vista basic, Japanese version. I don't know if there would be a trouble or not.

The code is also as follows:
------------------------------------------------
size(200,200);
colorMode(HSB,100);
background(100);
noStroke();
rectMode(CENTER);

int range=3;

for(int y=0 ; y<10 ; y++);{
 for(int x=0 ; x<10 ; x++);{
   fill(random(20, 40), 60, 100);
   rect(10 + x*20 + random(-range, range),
        10 + y*20 + random(-range, range),
        10, 10);
   }
}

Error message:

C:/Users/TUNGJE~1/AppData/Local/Temp/build2231.tmp/Temporary_309_4520.java:12:15
:12:15: Semantic Error: The field "x" in type "java.awt.Component" has default access and is not accessible here.

C:/Users/TUNGJE~1/AppData/Local/Temp/build2231.tmp/Temporary_309_4520.java:13:15
:13:15: Semantic Error: The field "y" in type "java.awt.Component" has default access and is not accessible here.

Wish some people knows about it,thanks

Tungjentsai
Re: Error code with java.awt.Component
Reply #1 - May 18th, 2007, 4:19pm
 
You've got some extraneous semi colons:

Code:
 for(int y=0 ; y<10 ; y++){ //<-- no ; before the {
for(int x=0 ; x<10 ; x++){ //<-- same here.
Page Index Toggle Pages: 1