java target
Posted: Tue Jan 17, 2006 8:17 am
hey! does anyone here know how to draw a target (the kind you would shoot at) in java? any help would be great (fast help would be best)
what i have now:
what i have now:
Code: Select all
import java.awt.*;
import java.applet.*;
public class final_class extends Applet
{
public void paint(Graphics g)
{
int dim = 0;
int x = 0;
int y = 0;
for (int i = 10; i > 0; i--)
{
dim = i * 10;
x = dim / 2;
y = dim * 2;
if ( i % 2 == 0)
g.setColor (Color.red);
else
g.setColor (Color.blue);
g.fillOval (x,y,dim,dim);//(y-axis, x-axis, height, width)
}
/*
int dim = 0;
for (int i = 0; i < 10; i++)
{
dim = i * 10;
g2d.drawRoundRect(dim, dim, 50, 50, dim, dim);
}
*/
}
}