Results 1 to 9 of 9
- 05-25-2011, 11:43 PM #1
Alternative way to create a circle propagation?
I've written the following code for the propagation of a circle. Is there an alternative or more efficient way to do this other than increasing the length by 2 for ever 1 decrease of the x and y values of the top left corner?
btw c.maxx and c.maxy calculates the maximum pixels for the width and length of output screen on my ide.
Im using HSA console on "Ready to Program with Java IDE".
thanks for any suggestions.
Java Code:// The "CircleProjection" class. import java.awt.*; import hsa.Console; public class CircleProjection { static Console c; // The output console public static void main (String[] args) { c = new Console (); int r = 0; int i = 0, a, b; a = (c.maxx ()) / 2; b = (c.maxy ()) / 2; while (i == 0) { c.setColor (new Color (0, 0, 255)); c.drawOval (a, b, r, r); try { Thread.currentThread ().sleep (1); } //end of try catch (Exception e) { } //end of catch c.setColor (new Color (255, 255, 255)); c.drawOval (a, b, r, r); a--; b--; r = r + 2; if (b == 0) { a = (c.maxx ()) / 2; b = (c.maxy ()) / 2; r = 0; } } //end of while loop } // main method } // CircleProjection classLast edited by Fubarable; 05-26-2011 at 04:48 AM. Reason: code tags added
- 05-26-2011, 12:55 AM #2
Have you taken a piece of paper and drawn a grid and drawn the circles? What do you have to do to keep the circles centered on the same point?increasing the length by 2 for ever 1 decrease of the x and y values
- 05-26-2011, 02:28 AM #3
I'm not entirely sure.....well i know i have to make the radius originate from the center and constant throughout. Other than that...?
- 05-26-2011, 02:33 AM #4
Have you taken a piece of paper and drawn a grid and drawn the circles?I'm not entirely sure.
- 05-26-2011, 02:51 AM #5
yes i just did, and i still can't figure out another method. any hints on what i should be looking for?
- 05-26-2011, 03:04 AM #6
I don't know if there is another method.
Wait till JosAH takes a look.
- 05-26-2011, 03:12 AM #7
yeah ok sure. who is that btw?
- 05-26-2011, 03:19 AM #8
Scan thru some of the forums and you should see where he has answered some questions.
- 05-26-2011, 04:23 AM #9
Similar Threads
-
alternative for ajax
By site4u in forum New To JavaReplies: 6Last Post: 04-28-2011, 01:15 PM -
Is there an alternative to OBEX?
By danielpereira in forum Advanced JavaReplies: 0Last Post: 10-17-2010, 11:36 PM -
Is EJB an alternative for JDBC?
By makpandian in forum Enterprise JavaBeans (EJB)Replies: 4Last Post: 01-06-2010, 09:14 AM -
Any Alternative to Swing?
By Niveditha in forum AWT / SwingReplies: 13Last Post: 06-27-2008, 09:39 AM -
propagation required in the transacctions of Spring
By Heather in forum Web FrameworksReplies: 2Last Post: 07-03-2007, 09:34 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks