TheBigPJ wrote:
> //Fill in the appropiate spot
> if(i == 1)
> {
> g.fillOval(2,62,12,12);
> }
> else if(i == 2)
> {
> g.fillOval(250,4,12,12);
> }
....
> else if(i == 16)
> {
> g.fillOval(137,455,12,12);
> }
A couple of observations:
1)
I'd use switch instead of long else if chains.
switch(i) {
case 1: g.fillOval(2,62,12,12); break;
case 2: g.fillOval(250,4,12,12); break;
...
case 16: g.fillOval(137,455,12,12);
}
2)
I'd define the coordinates in a Point[] at the start of the program so
that I could replace the above with the single line
g.fillOval(point[i].x, point[i].y, RADIUS,RADIUS);
The aim being to move long lists of constants somewhere where they don't
obscure the control structures. This helps keep methods short and
readable.
I would have tried to work out what is causing the problem you were
asking about, but you didn't supply an SSCCE.
--
RGB


|