Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #11545
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Whats the error in my program-creating overlapping GOval objects using GraphicsProgram |
| Date | 2012-01-20 21:52 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <jfd8pu$u2d$1@dont-email.me> (permalink) |
| References | <532275d9-eb03-4db0-a2ef-9b051de444cc@m4g2000pbc.googlegroups.com> |
On 01/20/2012 08:05 PM, student wrote:
> I am trying to create three concentric circles of different color
> using GraphicsProgram. However the circles never appear to be
> concentric..they appear to be pushed off on the sides of each other as
> if trying to show another dimension.
Reread the GOval documentation.
<http://jtf.acm.org/javadoc/student/acm/graphics/GOval.html#GOval(double,%20double,%20double,%20double)>
I am simply creating and adding
> the GOval objects. May be I am missing something. Is there a way to
> set transparency of the circles?
>
> Adding code below:
>
> import acm.graphics.*;
> import acm.program.*;
> import java.awt.*;
>
> public class Target extends GraphicsProgram {
>
> final static double radiusOuterCircle = 72.0;
> final static double radiusMiddleCircle = 47.0;
> final static double radiusInnerCircle = 22.0;
>
>
> public void run() {
>
>
> final double centerX = this.getWidth() / 2.0;
> final double centerY = this.getHeight() / 2.0;
>
>
> GOval g = makeCircle(centerX, centerY,radiusOuterCircle ,
> Color.RED);
> add(g);
>
>
> g = makeCircle(centerX, centerY,radiusMiddleCircle ,
> Color.WHITE);
> add(g);
>
>
> g = makeCircle(centerX, centerY,radiusInnerCircle ,
> Color.RED);
> add(g);
>
>
> }
>
>
>
> private GOval makeCircle(double centerX, double centerY, double
> radius, Color color)
> {
>
> GOval g = new GOval(centerX, centerY, radius, radius);
> g.setFillColor(color);
> g.setFilled(true);
>
> return g;
>
> }
> }
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Whats the error in my program-creating overlapping GOval objects using GraphicsProgram student <freenow12345@gmail.com> - 2012-01-20 17:05 -0800
Re: Whats the error in my program-creating overlapping GOval objects using GraphicsProgram Jeff Higgins <jeff@invalid.invalid> - 2012-01-20 21:52 -0500
Re: Whats the error in my program-creating overlapping GOval objects using GraphicsProgram student <freenow12345@gmail.com> - 2012-01-20 22:19 -0800
Re: Whats the error in my program-creating overlapping GOval objects using GraphicsProgram Lew <noone@lewscanon.com> - 2012-01-20 22:48 -0800
Re: Whats the error in my program-creating overlapping GOval objects using GraphicsProgram Jeff Higgins <jeff@invalid.invalid> - 2012-01-21 05:51 -0500
Re: Whats the error in my program-creating overlapping GOval objects using GraphicsProgram student <freenow12345@gmail.com> - 2012-01-21 18:08 -0800
Re: Whats the error in my program-creating overlapping GOval objects using GraphicsProgram Rajiv Gupta <rajiv@invalid.com> - 2012-01-21 14:43 +1100
csiph-web