Whenever you move one of the Simpsons, the connected arrows move along as well. Without any programming on my part! And the drag and drop is completely provided by the library as well. So, here I've moved Homer to the left and, as you can see, the connected arrows have moved too:
The coding is pretty simple. You create an object called a "Scene", add a "LayerWidget", and then put in some "ImageWidgets" and "ConnectionWidgets". It is all very well described in the (work in progress) Visual Library 2.0 API Documentation. For example, here's what a "ConnectionWidget" looks like:
ConnectionWidget connection1 = new ConnectionWidget(scene);
Getting started means checking out nbbuild, openide/util, core/external, and graph, exactly as described in the Setup Building Environment document.
There are really LOTS of samples. Seemed like there were about 30 or so, covering all areas of this library. To make my module, I went a slightly roundabout route, that worked nonetheless. After checking out and building as instructed, I opened the graph module's lib folder as a project in the IDE, created an NBM file from it, opened the NBM file outside the IDE, extracted the JAR file, and then created a library wrapper for the JAR file, which I attached to a module suite project. Then I created a functionality module that accesses classes in the library wrapper, after creating a dependency on the library wrapper from within the functionality module. Then I looked for a nice sample (in the examples folder) and pasted it into an Action class that I had generated via the New Action wizard. And then I expanded that sample slightly and ended up with the result that you see above. I then installed the library wrapper module and then the functionality module and accessed the Action class from the menu. And, with that, I had created my first implementation of the Visual Library 2.0.
Postscript: Here's the same motley crew, but this time in a TopComponent integrated in the IDE:
Once I've worked out how to generate code from the above (i.e., depending on who I've dragged and their relative positions, generate appropriate Java code or XML tags), I will provide step by step instructions for how to do all of this.