...when I suddenly, accidentally, moved the middle button (kind of a scrolly thing between the two click buttons) on my mouse. Imagine my surprise when my entire TopComponent suddenly zoomed bigger and bigger:
And, when I moved the middle scrolly button thing backwards, the whole TopComponent magically zoomed smaller:
Then this bit of code made sense:
And that's all I needed to implement that great piece of functionality. Just that one line!
But there was more... there's another line in my code, like this:
Thanks to that one single line, I can press down the middle scrolly button and move my mouse to the left or right when there's a scrollbar. Doing this moves the view along to the left or right, depending how I move my mouse. That's also a really cool feature, again provided by one line.
Both these actions are assigned to a Scene widget, which is the root of the tree of visual elements that you see in the illustrations above. Oh, by the way, the component palette is functional—you can drag and drop characters from the palette into the TopComponent. The biggest stumbling block for me, so far, is realizing how much easier all of this is than in the standard drag-and-drop functionality in the NetBeans APIs. I had to completely forget about the TopComponent's setDropTarget method. Everything is a whole lot simpler with the Visual Library 2.0. However, you first need to know how it is all done. And, fortunately for the rest of the world, the Visual Library 2.0 comes with a very large set of samples. So far, I've just been adapting the samples to my own needs. It's really worked out well so far and the work in progress Visual Library 2.0 document is also a good read, including small code snippets to explain how things fit together.