Mouse gestures are one of those great “add-ons” that enhance browser usability. For those that are not familiar with mouse gestures, they are a browser navigational aid that works via mouse movements. Mouse gestures have been around for some time now and we thought it would be good to show how to implement mouse gestures in WebRenderer.
This demonstration application not only aids in browser navigation, but also shows how to draw on top of the WebRenderer browser. To enact a mouse gesture one holds down the right mouse button and moves the mouse in a direction or pattern and the browser matches this pattern against a predefined list. After the browser interprets the mouse movement pattern it is matched to a browser action, such as “go back” or “reload page”. Mouse gestures can be visually interpreted by the user thanks to a “tail” which is drawn on the browser (web page) as the user performs the gesture.
The mouse gestures example including source code can be downloaded here..
Below is a screen capture of a mouse gesture in action. The thick red line is the gesture being performed by the user. The gesture underway in this screen capture is telling the WebRenderer browser to “Go Back”.

The example code can be launched with RunGestureBrowser.bat (included in the download). This particular launcher is for Windows, using WebRenderer libraries, although the demo will work on any platform supported by WebRenderer.
SOURCE CODE
There are two Java files for this demo:
TestBrowser.java is the standard WebRenderer Test Browser with two extra lines of code calling the Gestures class.
Gestures.java contains the relevant code for implementing the mouse gesture trails and actions.
The mouse gestures example including source code can be downloaded here..
|