Table of Contents

Getting Started I (Hello World)

Introduction

In this tutorial you will prepare your development environment for use with the Java bindings for GestureWorks Core. While no code will be written in this tutorial, the steps performed here will prepare your environment for subsequent GestureWorks Core Java tutorials. For this tutorial you will need the Gestureworks Core multitouch framework; a free trial is available.

Download the code for all of the Java & Java 2D multitouch tutorials here: tutorials_java_java2d.zip

GestureWorks Core "Bindings"

The various bindings included with GestureWorks Core allow a developer to create multitouch applications using their preferred language and framework, and are essentially mini-APIs providing an interface to the functions exported by the native GestureWorksCore library (GestureworksCore32.dll, GestureworksCore64.dll). Source code for each of the bindings is included so that you may extend or modify them as you like, as well as providing a blueprint for creating bindings for other languages or frameworks.

NetBeans and Java2D

The Java bindings for GestureWorks Core can be used by any Java project. The source code for the Java bindings is provided for portability and extensibility, but can be used quite effectively as-is in most situations.

In this and the following tutorials, NetBeans IDE 7 is used for demonstrating GestureWorks Core fundamentals using the Java bindings. Java2D is Java’s native drawing framework providing two-dimensional graphics, text, and imaging.


Requirements


Process Overview

Process Detail

1. Download and install software prerequisites

Each of the following software packages must be downloaded and installed prior to continuing with the tutorial.

NetBeans IDE 8.1 Java SE Bundle

2. Download and install GestureWorks Core package

The GestureWorks Core installer package – GestureWorksCoreSetup.exe – contains the main GestureWorksCore.dll files (the “native” DLLs), various bindings (C++, .NET, etc.), and supporting documentation. GestureWorksCore must be licensed prior to use in any software project.

  1. Download the GestureWorks Core Trial package from here.
  2. Double-click the downloaded installer package GestureWorksCoreSetup.exe to install GestureWorks Core.

GestureWorks Core consists of the GestureWorksCore DLLs as well as various tutorials and bindings:

GestureWorksCore*.dlls
\GestureWorksCore\GestureWorksCore32.dll
\GestureWorksCore\GestureWorksCore64.dll

Java bindings
\GestureWorksCore\bindings\java\gwc_java

Java tutorials
\GestureWorksCore\bindings\java\Java2D\tutorials

Assets for the tutorials
\GestureWorksCore\bindings\java\resources

3. Create a new Java project in NetBeans

First, create a new Java project

  1. Click File → New Project
  2. Under Categories, click Java
  3. Under Projects click Java Application
  4. Click the Next button
  5. Name the project “GestureWorksTutorial1”
  6. (optional) Click Browse… to select a location for the project folder
  7. Select the Create Main Class check box
  8. Rename the package and main class by replacing the default text with “packageA.Main”
  9. Click Finish

java_1.2.png

4. Add project dependencies

Next we need to add the following dependencies to the project. After a few edits, you’ll be able to start using the Java bindings to work with GestureWorks Core.

Open the gwc_java project and select the “Clean and Build” option to build the jar file in the project's “dist” directory (https://netbeans.org/kb/docs/java/quickstart.html#build). Right-click on the project in the Projects Explorer, then click Properties → Libraries → Add Project…

Java 1.3.png

Browse to the folder containing the downloaded GestureWorks Core files, navigate to the gwc_java bindings folder, click on the file and click Add Project JAR Files.

Java 1.4.png

Now add the jna.jar by selecting the Add JAR/Folder in the ProjectProperties window, navigate to the same gwc_java bindings folder, select jna-3.5.1 and click Open.

The last dependency we need to add is the resource files. Navigate to and copy the folder located at \GestureWorks\bindings\java\resources. Click the Files tab in NetBeans to switch to the Files view, right click on the root project folder, and click Paste.

The project and file tree structures should appear as follows, indicating the successful addition of the project libraries and resource folder. This will allow using the gwc_java binding’s code and local resources in the following tutorials.

Java 1.5.png

Java 1.6.png

5. Platform management

If the project’s platform is not targeting a compatible JDK, the platform settings will need to be configured. A 32 bit DLL requires a 32 bit JDK and a 64 bit DLL requires a 64 bit JDK.

  1. Target JDK
    • Right-click on the project in the Projects Explorer, then click Properties→ Libraries→Manage Platforms
    • In the Java Platform Manager window, select Add Platform…
    • Navigate to and select the desired JDK and click Next
    • Assign a unique platform name to the JDK and click Finish
    • Update the project’s platform by clicking the Java Platform: drop down menu and selecting the name of the recently added JDK

Java 1.7.png


Review

In this tutorial we installed GestureWorks Core, the prerequisites for developing with the GestureWorks Core Java bindings, and created a project that includes the Java bindings project. From here we move on to Java: Getting Started II (Hello Multitouch) in which we dig into actual source code, initializing GestureWorks Core and working with touch and gesture event data.


Next tutorial: Java: Getting Started II (Hello Multitouch)