• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Drawing a graph with some nodes dynamically

 
sneha kk
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to java swing and I just want to know if we can draw graph with some nodes dynamically.

For example if there are 5 nodes and if a message comes from one of nodes may be 4 saying that 3 is its parent then we should represent nodes 4, 5 and we should draw a link between those two. And it is similar for the other nodes.

I would appreciate if any one can help me with this..

Thanks.
 
Stephan Mueller
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

You may want to check out http://download.oracle.com/javase/tutorial/uiswing/components/tree.html
Swing's treeModel provides much of the functionality you may want for representing a graph with parent/child - nodes.
 
sneha kk
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
functionality is the same. But I want to represent the nodes with circles and the parent child relationship with a line between them.

Thanks.
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cross posted
http://forums.sun.com/thread.jspa?threadID=5449079
 
Rob Spoor
Sheriff
Pie
Posts: 20665
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"sneha kk",

Apart from following the instructions in your private messages, please BeForthrightWhenCrossPostingToOtherSites.
 
sneha kk
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Rob for letting me know about this. I will do it from the next time.
 
Rob Spoor
Sheriff
Pie
Posts: 20665
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please also follow the instructions in your private messages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic