Java Applet : Nested Loops color change
Posted
by Bader
on Stack Overflow
See other posts from Stack Overflow
or by Bader
Published on 2010-05-09T00:14:26Z
Indexed on
2010/05/09
0:18 UTC
Read the original article
Hit count: 182
Hello
I have like a table to make a nested loop in Java applet , during this loop i should change the colors like the picture said.
now i successed to make the table but i cannot change the colors because every time i try a forumla , it doesn't work.
Here is my code
int x = 63;
for (int r=1; r<=10;r++)
{
Color C = new Color(0,10 +(x * 2),0);
for (int c=0; c<=4; c++)
{
Color C2 = new Color(10 + (x * 2) ,0,0);
g.setColor(C2);
Font F = new Font("Arial",Font.BOLD, 24);
g.setFont(F);
g.drawString("Hello",10 + ( c * 60), r * 25 );
}
}
what should i do to make it work ?
© Stack Overflow or respective owner