5 Comments

Comment Utility

Hi bobbit31 and anyone else,

This is the kind of end result that I need, although I wouldnt need the ovalshapes and typing function would be good.

However this is all well and good but I do really need code with commenting in it as this is too hard, on its own to understand. If you know of anything that will teach me how to do this or know of similar code with lots of commenting in it that would be great.

Thanx for your previous response

This is the kind of end result that I need, although I wouldnt need the ovalshapes and typing function would be good.

However this is all well and good but I do really need code with commenting in it as this is too hard, on its own to understand. If you know of anything that will teach me how to do this or know of similar code with lots of commenting in it that would be great.

Thanx for your previous response

Comment Utility

Matthelene,

Rather than spend lots of words on something that is not of interest to you can you specify a shape?

Neither do I understand your math background.

So I may be off the mark with this help.

There are shapes already defined in Java that are can be drawn with careful attention to the definition and what the specific shape like a oval creates. An oval whose height and width are the same value draws a circle. An oval whose height and width are the not the same value draws an oval in the more general way that it is understood.

Here is a bit of commentary that could lead to your understanding of the circle using the oval. BUT question me after seeing this.

import java.applet.Applet;

import java.awt. * ;

/*

* Parameters: the x1 coordinate of the upper left corner of the

* to be drawn, the y1 coordinate of the upper left corner of the oval

* to be drawn, the width x2 is the width of the oval to be drawn, the height

* y2 is the height of the oval to be drawn.

*/

public class ovalExperiment extends Applet {

public void paint(Graphics g) {

// center specified

int cx = 150;

int cy = 225 ;

//Creating some steps

for (int i = 1; i <= 4; i++) {

int d1 = 30 * i; // for a circle make the multiplier of i the same number

int d2 = 30 * i; // for an ellipse make the multipliers of i different numbers

// as in int d1 = 30 *i; int d2 = 20 *i;

/*

* getting the upper left of a rectanlgle that is centered about cx and cy

* on a coordinate system subtract d1 from cx and subtract d2 from cy

*/

int x1 = cx - d1;

int y1 = cy - d2;

/* This is 2 times d1 units wide and 2 times d2 units high*/

int x2 = 2 * d1;

int y2 = 2 * d2;

/*make it a random color for accent or specify one color*/

Color rndm = new Color((int)(Math.random() * 255),(int)(Math.random() * 255),(int)(Math.random() * 255));

// or use g.setColor(Color.red);

g.setColor(rndm);

g.drawOval(x1,y1,x2,y2);

}

}

}

Delphi3

Rather than spend lots of words on something that is not of interest to you can you specify a shape?

Neither do I understand your math background.

So I may be off the mark with this help.

There are shapes already defined in Java that are can be drawn with careful attention to the definition and what the specific shape like a oval creates. An oval whose height and width are the same value draws a circle. An oval whose height and width are the not the same value draws an oval in the more general way that it is understood.

Here is a bit of commentary that could lead to your understanding of the circle using the oval. BUT question me after seeing this.

import java.applet.Applet;

import java.awt. * ;

/*

* Parameters: the x1 coordinate of the upper left corner of the

* to be drawn, the y1 coordinate of the upper left corner of the oval

* to be drawn, the width x2 is the width of the oval to be drawn, the height

* y2 is the height of the oval to be drawn.

*/

public class ovalExperiment extends Applet {

public void paint(Graphics g) {

// center specified

int cx = 150;

int cy = 225 ;

//Creating some steps

for (int i = 1; i <= 4; i++) {

int d1 = 30 * i; // for a circle make the multiplier of i the same number

int d2 = 30 * i; // for an ellipse make the multipliers of i different numbers

// as in int d1 = 30 *i; int d2 = 20 *i;

/*

* getting the upper left of a rectanlgle that is centered about cx and cy

* on a coordinate system subtract d1 from cx and subtract d2 from cy

*/

int x1 = cx - d1;

int y1 = cy - d2;

/* This is 2 times d1 units wide and 2 times d2 units high*/

int x2 = 2 * d1;

int y2 = 2 * d2;

/*make it a random color for accent or specify one color*/

Color rndm = new Color((int)(Math.random() * 255),(int)(Math.random() * 255),(int)(Math.random() * 255));

// or use g.setColor(Color.red);

g.setColor(rndm);

g.drawOval(x1,y1,x2,y2);

}

}

}

Delphi3

Comment Utility

No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

PAQ'd and pts refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Venci75

EE Cleanup Volunteer

I will leave a recommendation in the Cleanup topic area that this question is:

PAQ'd and pts refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Venci75

EE Cleanup Volunteer

Comment Utility

per recommendation

SpideyMod

Community Support Moderator @Experts Exchange

SpideyMod

Community Support Moderator @Experts Exchange

Title | # Comments | Views | Activity |
---|---|---|---|

powerN challenge | 3 | 46 | |

best (free) software to access postgres db (java) | 1 | 17 | |

JAVA part two | 5 | 39 | |

recursion example | 16 | 65 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**12** Experts available now in Live!