public void draw( Graphics g) {Graphics2D g2d = (Graphics2D) g;final int x = getX();final int y = getY();g2d.setColor( Color.GREEN );g2d.setPaint( new GradientPaint( x,y,Color.GREEN,x + RADIUS/4,y + RADIUS/4,Color.BLACK,true) );int xOffset = 0;int yO

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/20 08:26:52
public void draw( Graphics g) {Graphics2D g2d = (Graphics2D) g;final int x = getX();final int y = getY();g2d.setColor( Color.GREEN );g2d.setPaint( new GradientPaint( x,y,Color.GREEN,x + RADIUS/4,y + RADIUS/4,Color.BLACK,true) );int xOffset = 0;int yO
xkP+o1M6iIH3 sɲ">tm“6A_s\9ygh%ce(3,*" 2\">Y1,Gy73q j޴mڮ쓙Y(`໦b7Q64o@Bd$XRfo, rե+Sӗe]DLڛTs\%]iNcD#A y8s^𷸰p`X='Janq$8jqUlsIKohc$ i8U-dQCx^mv^nKGP%N>(Pm~OkzQA_m߹CC$ kܧ۝gDp“bKy@߼kk'_uWӬ2OnH8wjG(|J936)r^?0V

public void draw( Graphics g) {Graphics2D g2d = (Graphics2D) g;final int x = getX();final int y = getY();g2d.setColor( Color.GREEN );g2d.setPaint( new GradientPaint( x,y,Color.GREEN,x + RADIUS/4,y + RADIUS/4,Color.BLACK,true) );int xOffset = 0;int yO
public void draw( Graphics g) {
Graphics2D g2d = (Graphics2D) g;
final int x = getX();
final int y = getY();
g2d.setColor( Color.GREEN );
g2d.setPaint( new GradientPaint( x,y,Color.GREEN,x + RADIUS/4,y + RADIUS/4,Color.BLACK,true) );
int xOffset = 0;
int yOffset = 0;
for( int i = 0; i < DENSITY; i++) {
xOffset = (int) (Math.random()*RADIUS);
yOffset = (int) (Math.random()*RADIUS);
g2d.draw( new Ellipse2D.Double( x + xOffset,y + yOffset,x + xOffset+3,y + yOffset+3) );
}
}

public void draw( Graphics g) {Graphics2D g2d = (Graphics2D) g;final int x = getX();final int y = getY();g2d.setColor( Color.GREEN );g2d.setPaint( new GradientPaint( x,y,Color.GREEN,x + RADIUS/4,y + RADIUS/4,Color.BLACK,true) );int xOffset = 0;int yO
public void draw( Graphics g) {
Graphics2D g2d = (Graphics2D) g;//转化g的类型为Graphics2D
final int x = getX()//;取得x坐标
final int y = getY();//取得y坐标
g2d.setColor( Color.GREEN );//设置填充色green
g2d.setPaint( new GradientPaint( x, y, Color.GREEN, x + RADIUS/4, y + RADIUS/4, Color.BLACK, true) );//设置填充方式,从点x,y到点x + RADIUS/4, y + RADIUS/4的颜色渐变从green到black
int xOffset = 0;//初始化x轴偏移变量
int yOffset = 0;//初始化y轴偏移变量
for( int i = 0; i < DENSITY; i++) {循环
xOffset = (int) (Math.random()*RADIUS);
yOffset = (int) (Math.random()*RADIUS);
g2d.draw( new Ellipse2D.Double( x + xOffset, y + yOffset, x + xOffset+3, y + yOffset+3) );//画一个椭圆
}
}