• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Polyline question

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Is there a class in Java that supports Polyline. Lets say I have points (10,20) (20,30) (40,50) (60,70). Can I construct a line with all these points. I saw in java.awt.geom package, there is a class Line2D, but it can take only two points. What if I wanna construct a line with 'n' points?
 
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think there is, but you shouldn't have too much of a problem rolling your own.


[ January 03, 2007: Message edited by: Garrett Rowe ]
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Graphics class lists a method with this signature

Another useful class is GeneralPath. moveTo the first set of coordinates and lineTo each of the next in sequence. For a closed path (optional) either closePath or lineTo the initial set of coordinates.
 
Ravi Kotha
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Rowe



My problem is not drawing lines. Lets say I have set of points coming from the front end (10,20) (30,50), (45,67), (87,34). Using these points I want to form a polyline which includes all the points. How can I do that?
 
Ravi Kotha
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Craig,

Hope it will be helpful.
 
reply
    Bookmark Topic Watch Topic
  • New Topic