WYLIWYT - where you look is where you type in NetBeans
In my latest blog
I wrote about the TrackIR device and my Java binding
JTrackIR. The device allows to track
the users head position and attitude in front of the screen using infrared reflecting strips on a basecap
the user has to wear.
Now what to do with it? What about controlling the IDE with the head? Activating different areas
(editor, properties, output ...) by just looking at them. So that the keyboard focus is always in the window
I am looking at.
A good opportunity for an excercise of
NetBeans module development that I did not do for quite a
time now (NB5 or so...).
Creating the infrastructure for the module was surprisingly easy. Just calling some wizards for a library module wrapping
jtrackir.jar, a module that does the actual work and a module suite sueing everything together.
Finally I created a
TopComponent that can control the TrackIR device. I configured the suite to be a standalone application
and added some IDE modules to have some more windows for testing. Very easy.
TopComponent is meant to visualize where the user is looking at. For that, a scheme of the current
layout - that's how NetBeans calls the different areas of a GUI application - is rendered as it can be seen at the bottom
left of the screenshot. The red dot is the place I'm currently looking at.
To code the functionality I needed some help from the web, but as soon as somebody guide me to
the rest was quite easy.
Using the module requires a bit of practise and fine tuning the 'sensitivity' value. After that, it is possible to
have the focus really in the window I am looking at. I admit the module is of low practical value, but at least it was fun to
create the module and get acquainted with some NetBeans APIs e.g. like NbPreferences used to save the sensitivity
It was my first time creating, starting and debugging an appplication with the NetBeans RCP and I have to say:
very easy, very cool, it just worked! I was suprised how fast the edit-compile-debug cycle was (that has to launch
a full copy of the NetBeans framework) even on my poor notebook.
I can encourage everybody to try it out.