Question

I need to dynamically draw (star) topologies in a Java GUI application. By star topology, I mean something like this:

network topology
(source: thebryantadvantage.com)

It doesn't need to be over-fancy, but I don't want to do it too ugly and crude. By dynamically I mean that the topology changes infrequently over time, but as the number of nodes is very small, a complete repaint won't hurt.

I googled around for some time, but I couldn't find anything helpful - maybe I'm just googling the wrong keywords. I'm also using JFreeChart, but from what I can see, there's no class included for something like that. A friend of mine suggested searching for mindmapping libraries for Java, but I can just find complete applications, which is an overkill.

I can't believe there is no alternative to mess around with Shapes, Lines etc.? I'm currently using a JTree, but I can't believe there aren't any better ways to do that.

Additional infos: I have a small number (<10) of root nodes and possibly a small number of leafs (<10). It's about a VM<->Server mapping, so the leafs will change their parent over time. Some "animation" while live migration would be cool, but is not required in the first step.

Thanks, and please excuse anything I missed - this is my first question here.

Was it helpful?

Solution

I believe that one of the demos in the JDK is a dynamic graph layout (not 100% sure, it's been years since I've run them). You probably wouldn't need its whiz-bang animation, but I bet the code is fairly small and definitely self-contained.

Perhaps you could adapt it so that the steps it takes toward finding a layout aren't animated; it just displays the final state.

OTHER TIPS

Perhaps GraphViz would work for you?

EDIT:

OK, what about JGraphT

Here's a nice implementation of a StarLayout.

NetBeans offers a nice graphical library (visual library). E.g. the maven plugin uses this to draw all the dependencies

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top