Tag Archives: JUNG

Learning JUNG (3) – Changing the vertex’s shape

To change the way a vertex is rendered, you provide an implementation of the Renderer.Vertex interface. The interface has one function – paintVertex – where you can draw anything you like, like in the graphics of any JComponent. I changed my example, adding 3 nodes: a circle, a square and a rectangle, each one painted with it’s shape and in a different color. And the results are favorable: P.D: Yes, I know that the code is ugly, is not OO, has numbers instead of constants, etc… I have no good excuse.

Posted in Programming | Tagged , , , , | 2 Comments

Learning JUNG (2) – Adding labels

That was very easy. First I changed the VisualizationImageServer for a VisualizationViewer. The name of the variable was also changed from vs to vv. The new class is the one used in all the JUNG examples, therefore it is probably better (talk about programming by coincidence). After doing this, I added the following lines after the creation of the VisualizationViewer: Transformer is an apache commons collections library that simply defines a one-way transformation between objects of two types (why isn’t this part of the standard Java libraries???). After defining the Transformer, it is added to the visualization engine using the … Continue reading

Posted in Programming | Tagged , , | Leave a comment

Learning JUNG – Java Universal Network/Graph Framework

I’m searching for “user-friendly” java graph frameworks for an application that I’m developing for my studies. I stumbled upon JUNG. After 15 minutes searching and reading, I managed to create a directed graph and show it on screen. And this is the output graph: Next step: Try to show labels and try to change the vertex shapes.

Posted in Programming | Tagged , , , | 3 Comments