draw Ball - Java java.awt

Java examples for java.awt:Graphics2D

Description

draw Ball

Demo Code

/*//from  ww w  . j a  va  2 s . com
TOD - Trace Oriented Debugger.
Copyright (c) 2006-2008, Guillaume Pothier
All rights reserved.

This program is free software; you can redistribute it and/or 
modify it under the terms of the GNU General Public License 
version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
General Public License for more details.

You should have received a copy of the GNU General Public License 
along with this program; if not, write to the Free Software 
Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
MA 02111-1307 USA

Parts of this work rely on the MD5 algorithm "derived from the 
RSA Data Security, Inc. MD5 Message-Digest Algorithm".
 */
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;

public class Main{
    public static void drawBall(Graphics2D g, UPoint p, float r,
            Color aColor) {
        drawBall(g, p.x, p.y, r, aColor);
    }
    public static void drawBall(Graphics2D g, float x, float y, float r,
            Color aColor) {
        g.setColor(aColor);
        g.fill(new Ellipse2D.Float(x - r, y - r, r * 2, r * 2));
    }
}

Related Tutorials