Drawing a Circle

Page 1 of 1

3 Replies - 96398 Views - Last Post: 19 September 2006 - 09:50 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=18752&amp;s=0facf54d692d37eed87c31e7224c3c56&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#1 fredcs1

Reputation: 0
• Posts: 2
• Joined: 19-September 06

Drawing a Circle

Posted 19 September 2006 - 06:11 PM

How does one make a circle in Java using an equation? I am new at Java, trying to teach myself but this is stumping me.
Is This A Good Question/Topic? 0

Replies To: Drawing a Circle

#2 oneminizut

Reputation: 1
• Posts: 12
• Joined: 14-September 06

Re: Drawing a Circle

Posted 19 September 2006 - 08:28 PM

Sounds like the hard way to going about it but here is a link
circle equation

Now, to do it in an applet is very easy;

```import java.awt.*;
import javax.swing.*;

public class GraphicsExample extends JApplet
{

public void paint(Graphics g)
{

// call superclass version of method paint
super.paint( g );

// draw oval
g.setColor( new Color(0,0,0));
g.drawOval(50,75,100,100);

}

}

```

#3 TexasLonestar

Reputation: 1
• Posts: 14
• Joined: 10-August 06

Re: Drawing a Circle

Posted 19 September 2006 - 09:07 PM

You might want to look into gBuffer after you learn g, and when you start doing animations be sure to include the paint() class.

#4 Datalus

Reputation: 0
• Posts: 235
• Joined: 18-December 05

Re: Drawing a Circle

Posted 19 September 2006 - 09:50 PM

heres a hint:

X of a = radius*sin( theta )
Y of a= radius*cos( theta )

X of b = radius*sin( theta + delta )
X of b = radius*cos( theta + delta )