users
[Top] [All Lists]

RE: [cinjug-users] tracing a path

To: "'Jason Kretzer'" <jrkretzer@xxxxxxxxx>, <users@xxxxxxxxxx>
Subject: RE: [cinjug-users] tracing a path
From: "James Carman" <james@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Mar 2005 09:58:56 -0500
Delivered-to: mailing list users@cinjug.org
Importance: Normal
In-reply-to: <20050315145356.73815.qmail@web50105.mail.yahoo.com>
Mailing-list: contact users-help@cinjug.org; run by ezmlm
Organization: Carman Consulting, Inc.
You might want to check out the java.awt.geom.GeneralPath class (which is a
Shape), then.  You can use that to store the path that the ball or "point"
has followed (as line segments).  Then, during your paint operation, you
just paint the shape (the GeneralPath).

-----Original Message-----
From: Jason Kretzer [mailto:jrkretzer@xxxxxxxxx] 
Sent: Tuesday, March 15, 2005 9:54 AM
To: James Carman; users@xxxxxxxxxx
Subject: RE: [cinjug-users] tracing a path


It would if the application did not stop.  :)

I am just trying to have little ball move across the
frame by coordinates that are calculated in a loop.  I
need to leave a line behind the ball as it moves from
one position to another.  Of course, once it reaches
the edge of the frame which is the terminating
condition, the ball stops.

-Jason


--- James Carman <james@xxxxxxxxxxxxxxxxxxxx> wrote:
> Are you trying to perpetually keep the path on the
> screen?  So, basically,
> your screen will look like a bunch of lines after a
> while?
> 
> -----Original Message-----
> From: Jason Kretzer [mailto:jrkretzer@xxxxxxxxx]
> Sent: Tuesday, March 15, 2005 9:44 AM
> To: users@xxxxxxxxxx
> Subject: Re: [cinjug-users] tracing a path
> 
> 
> OK, I have this part.  How would one go about
> getting
> the points to stay put?  After I draw a point and
> call
> repaint on the JComponent toshow that point, the
> point
> that I drew just before that disappears.
> 
> To work around that I am keeping a collection of all
> points and redrawing all of them every time a new
> point needs drawn.  This does OK but is terribly
> inefficient and little choppy.
> 
> Basically, every time I compute a new point, I need
> it
> drawn without erasing any other previous point.
> 
> Does that make sense?
> 
> Thanks for your help everyone.
> 
> -Jason
> 
> 
> --- Chris McMahan <cmcmahan@xxxxxxx> wrote:
> > The secret is to think of it not as a line, but as
> a
> > series of
> > points. The applet you pointed out is merely
> drawing
> > points on the
> > canvas at the specified interval.
> > 
> > Just extract the point's position at a certain
> point
> > in your code as
> > it moves around, and draw another point at those coordinates.
> > 
> > - Chris
> > 
> > Jason Kretzer writes:
> > >Hello all:
> > >
> > >I am trying to draw a line behind a moving point
> so
> > as
> > >to draw the path of the point. I have looked
> > through
> > >the books that I have and I cannot seem to find
> > >exactly what I need.
> > >
> > >Here is a website that has an applet that shows
> > what I
> > >am trying to do.  Notice how the path is left
> > behind
> > >the moving ball image.
> > >
> >
>
>http://www.phys.hawaii.edu/~teb/java/ntnujava/bouncingBall/bouncingBall
> >.html
> > >
> > >Any other resources would be appreciated.
> > >
> > >Thanks for the help.
> > >
> > >-Jason
> > >
> > 
> > -- 
> >     ================================
> >     Chris McMahan | cmcmahan@xxxxxxx
> >     ================================
> > 
> > 
> 
> 
>               
> __________________________________
> Do you Yahoo!? 
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/ 
> 
> ---------
> You may unsubscribe from this mailing list
> by sending a blank email addressed to: users-unsubscribe@xxxxxxxxxx
> 
> --
> Find additional help by sending a blank email
> addressed to:
> users-help@xxxxxxxxxx
> 
> 
> 
> ---------
> You may unsubscribe from this mailing list
> by sending a blank email addressed to: users-unsubscribe@xxxxxxxxxx
> 
> --
> Find additional help by sending a blank email
> addressed to:
> users-help@xxxxxxxxxx
> 
> 


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 



<Prev in Thread] Current Thread [Next in Thread>