Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #11545

Re: Whats the error in my program-creating overlapping GOval objects using GraphicsProgram

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
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 Fri, 20 Jan 2012 21:52:39 -0500
Organization A noiseless patient Spider
Lines 65
Message-ID <jfd8pu$u2d$1@dont-email.me> (permalink)
References <532275d9-eb03-4db0-a2ef-9b051de444cc@m4g2000pbc.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Sat, 21 Jan 2012 02:44:14 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="qwFw1g9RsQ6TkML5yezG9A"; logging-data="30797"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192gH15If97Mbo/1Y9c979gnK+k3UU4ExU="
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20111110 Icedove/3.0.11
In-Reply-To <532275d9-eb03-4db0-a2ef-9b051de444cc@m4g2000pbc.googlegroups.com>
Cancel-Lock sha1:ajThEv6yELUXO8DeJViI09vvuac=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11545

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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