Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

shape path iterator

843807Jan 20 2005 — edited Jan 23 2005
I have searched the forum to no avail, and have only found one tutorial that gets remotely close to what I am trying to do (i.e. http://www.developer.com/java/other/article.php/626101)

Here's the jest:

I've got a circle that has a linecoming out of it. Each line connects to the end point of the previous one, so if you will, think of this as one big connected path made of up lines of variable size.

Currently my circle class extends Ellipse2D.Double and houses a global LinkedList that houses the lines. Everything works perfect, BUT NOW I need to figure out some way to have the circle move along this proverbial connected line. Here's what I have attempted in much simplified form:
ListIterator lineIterator = currentCharacter.lineList.listIterator();
while (lineIterator.hasNext())
{
  StraightLine currentLine = (StraightLine)lineIterator.next();
  // here it draws the line on the screen

  generalPath.append(currentLine, true);
}
I won't even both including my feable attempt at getting it to work with a PathIterator other than the following statement which instantiates the iterator:
PathIterator path = generalPath.getPathIterator(null);
Can someone please point me in the right direction. I would like for the circle to move position by position in the current segment before moving on to the next, AND not just move segment to segment. I'm having a real hard time understanding the PathIterator interface, so if anyone could give me a few pointers, I'd be much obliged.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 20 2005
Added on Jan 20 2005
10 comments
145 views