• 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

Displaying a graph

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an input file that stores nodes and edges, I want to show the graph using the input file and don't want edges to intersect each other. Edges don't have to be straight lines. To represent an edge between two distant nodes (without crossing other edges) an arc can be used.
Anyidea, how this can be done?
Thanks.
Vibha.
 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vibha:
I don't know of a standard Java Class that would do this. What I would suggest is to build a class that can hold the data from your input file as a data structure of some type. Then build a new class that extends JPanel. You would overwrite the paint method of that class to paint (using 2D Graphics) your graph based on the data structure that is passed to it. Then display that new class in the ContentPane of a JFrame (or wherever you need to put it).
It's going to be a lot of "do it by hand" work to get it up and running though. Good luck.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic