This chapter was previously labelled as "NUI Chapter 16.7".
OpenNI gestures and NITE hand tracking open the door to new kinds of user interfaces utilizing (what I'll call) gesture GUI (GGUI) components. I'll develop three examples in this chapter – a GGUI button, slider, and dial, which are shown deactivated at the top of the screenshot.
GGUI components share the same general behavior by inheriting a superclass which allows a component to move between three states: inactive, active and pressed.
A component is activated when the user's hand enters its area on screen. The component's image changes (there are examples below), and may react to hand movements inside its area. For example, the slider tab moves left and right, and the dial knob rotates. If the user doesn't move their hand for two seconds while inside the component, it changes to the pressed state.
The user knows when a component is active or pressed by its appearance changing, as illustrated below for the button, slider, and dial GGUIs.
The pressed states for the slider and dial have a small yellow circle on the slider tab and in the center of the dial knob.
When a component first enters the pressed state, it sends a state object to the top-level JFrame. In my example application, this information is only printed out, but it could be utilized in more complex ways.
The button state object contains the name of the button that been pressed. The slider returns an integer in the range 0-100, corresponding to the tab's relative position along the slider ruler. The dial sends an angle in degrees representing the angle that the dial's knob line makes with the positive x-axis. For instance, the information printed for the three pressed states shown above are:
"Press me" BUTTON "Slide me" SLIDER; range: 42 "Turn me" DIAL; angle: 49
The quoted string is the name of the GGUI component, the capitalized word is the component type, and is followed by the data (in the case of the slider and dial). The slider tab is a little less than halfway along the slider ruler, while the knob line is 49 degrees counter-clockwise to the positive x-axis.