How to create a network picture Using Java [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
开发者_开发技巧Closed 7 years ago.
Improve this questionA project that I am working on requires me to show the network layout when the user clicks on a button on a GUI panel “Show Network Layout”. Example: X is the name of a sub-network and x1, x2, x3 are the connected devices. Similarly, Y is the name of a sub-network and y1, y2, y3 are the connected devices and so on. How they are connected to each other and in which direction is defined in a flat file. This is how the image should look:
Network Image
Uploaded with [URL=http://imageshack.us]ImageShack.us[/URL]
The question is what is the best way I can do this using Java. Am not asking for the programming part but what Java tool can be used to accomplish this. A sample example would be really helpful.
Thanks
Since your sample picture is a directed graph, JGraph would be a nice tool to use. An other great option is JGraphT. Both links have sample code. The second link uses an applet, so you can see directly the graph and the necessary code, in order to create it. JGraph is very similar.
For displaying a graph I would typically suggest to use the Jung library. However for a network layout a JTree
is sufficient, easy, and is what most users typically are used to seeing.
You could use the NetBeans Visual Library:
http://platform.netbeans.org/graph/
Here are some example screen shots: http://platform.netbeans.org/graph/screenshots.html
It's commercial and probably not cheap, but I've used Tom Sawyer's products with great success in the past.
精彩评论