import java.io.IOException;

import com.leapmotion.leap.*;
import com.leapmotion.leap.Gesture.State;

class LeapListener extends Listener {
	
	//Controller initialized
	public void onInit(Controller controller) {
		System.out.println("Initialized");
	}
	
	//Controller connected
	public void onConnect(Controller controller) {
		System.out.println("Connected to motion Sensor");
		
		//Declare Gestures
		controller.enableGesture(Gesture.Type.TYPE_SWIPE);
		controller.enableGesture(Gesture.Type.TYPE_CIRCLE);
		controller.enableGesture(Gesture.Type.TYPE_SCREEN_TAP);
		controller.enableGesture(Gesture.Type.TYPE_KEY_TAP);
	}
	
	//Controller disconnect
	public void onDisconnect(Controller controller) {
		System.out.println("Motion sensor disconnected");
	}
	
	//Controller exit
	public void onExit(Controller controller) {
		System.out.println("Exited");
	}
	
	//Frame method
	public void onFrame(Controller controller) {
		
		Frame frame = controller.frame();
		
		//Frame Data
		/*System.out.println("Frame id: " + frame.id()
							+ ", Timestamp: " + frame.timestamp()
							+ ", Hands: " + frame.hands().count()
							+ ", Fingers: " + frame.fingers().count()
							+ ", Tools: " + frame.tools().count()
							+ ", Gestures: " + frame.gestures().count());
		
		for (Hand hand : frame.hands()) {
			String handType = hand.isLeft() ? "Left Hand" : "Right Hand";
			System.out.println(handType + " " + ", id: " + hand.id()
								+ ", Palm Position: " + hand.palmPosition());
			
			Vector normal = hand.palmNormal();
			Vector direction = hand.direction();
			
			System.out.println("Pitch: " + Math.toDegrees(direction.pitch())
								+ "Roll: " + Math.toDegrees(normal.roll())
								+ " Yaw: " + Math.toDegrees(direction.yaw()));
				
		}*/
		
		for (Finger finger : frame.fingers()) {
			System.out.println("Finger Type: " + finger.type()
								+ "ID: " + finger.id()
								+ "Finger length (mm): " + finger.length()
								+ "Finger width (mm): " + finger.width());
		}
		
	}
}

public class LeapController {

	public static void main(String[] args) {
		LeapListener listener = new LeapListener();
		Controller controller = new Controller();
		
		controller.addListener(listener);
		
		System.out.println("Press enter to quit");
		
		
		try {
			System.in.read();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		controller.removeListener(listener);
		
	}

}

@@ -1817,16 +1817,18 @@
 rintln(%22
+//
 Finger T
@@ -1861,16 +1861,18 @@
 %09%09%09%09%09+ %22
+  
 ID: %22 + 
@@ -1890,24 +1890,26 @@
 %0A%09%09%09%09%09%09%09%09+ %22
+  
 Finger lengt
@@ -1947,16 +1947,18 @@
 %09%09%09%09%09+ %22
+  
 Finger w
@@ -1991,20 +1991,305 @@
 h());%0A%09%09
-%7D
 %0A%09%09
+%0A%09%09%09for (Bone.Type boneType : Bone.Type.values()) %7B%0A%09%09%09%09Bone bone = finger.bone(boneType);%0A%09%09%09%09System.out.println(%22Bone Type: %22 + bone.type()%0A%09%09%09%09%09%09%09%09%09+ %22 Start: %22 + bone.prevJoint()%0A%09%09%09%09%09%09%09%09%09+ %22 End: %22 + bone.nextJoint()%0A%09%09%09%09%09%09%09%09%09+ %22 Direction: %22 + bone.direction());%0A%09%09%09%09%0A%09%09%09%7D%0A%09%09%09%0A%09%09%7D
 %0A%09%7D%0A%7D%0A%0Ap

Add bone type detection