aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Drawing a graph with some nodes dynamically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Drawing a graph with some nodes dynamically" Watch "Drawing a graph with some nodes dynamically" New topic
Author

Drawing a graph with some nodes dynamically

sneha kk
Greenhorn

Joined: Aug 03, 2009
Posts: 6
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

Joined: May 05, 2010
Posts: 50
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.


1. Make it run - 2. Make it run correctly - 3. Make it pretty OR fast/small - 4. ??? - 5. Profit
sneha kk
Greenhorn

Joined: Aug 03, 2009
Posts: 6
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

Joined: May 03, 2008
Posts: 4530
    
    5

Cross posted
http://forums.sun.com/thread.jspa?threadID=5449079


luck, db
There are no new questions, but there may be new answers.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

"sneha kk",

Apart from following the instructions in your private messages, please BeForthrightWhenCrossPostingToOtherSites.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
sneha kk
Greenhorn

Joined: Aug 03, 2009
Posts: 6
Thank You Rob for letting me know about this. I will do it from the next time.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

Please also follow the instructions in your private messages.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Drawing a graph with some nodes dynamically