title: How to develop multi-touch applications in ubuntu 16.04 through javafx？
body: <pre><code>The javafx application：
  import javafx.application.Application;
  import javafx.event.EventHandler;
  import javafx.scene.Group;
  import javafx.scene.Scene;
  import javafx.scene.input.MouseEvent;
  import javafx.scene.input.RotateEvent;
  import javafx.scene.input.ScrollEvent;
  import javafx.scene.input.SwipeEvent;
  import javafx.scene.input.TouchEvent;
  import javafx.scene.input.ZoomEvent;
  import javafx.scene.shape.Rectangle;
  import javafx.stage.Stage;
  public class Main extends Application {
    public static void main(String[] args) {
      Application.launch(args);
    }
  
    @Override
   public void start(Stage primaryStage) {
      Group root = new Group();
      Scene scene = new Scene(root, 300, 250);
  
  Rectangle rect = new Rectangle();
  rect.setWidth(100);
  rect.setHeight(100);
  root.getChildren().add(rect);
  rect.setOnScroll(new EventHandler&lt;ScrollEvent&gt;() {
    @Override
    public void handle(ScrollEvent event) {
      if (!event.isInertia()) {
        rect.setTranslateX(rect.getTranslateX() + event.getDeltaX());
        rect.setTranslateY(rect.getTranslateY() + event.getDeltaY());
      }
      System.out.println("Rectangle: Scroll event" + ", inertia: "
          + event.isInertia() + ", direct: " + event.isDirect());
      event.consume();
    }
  });
  
  rect.setOnScrollStarted(new EventHandler&lt;ScrollEvent&gt;() {
    @Override
    public void handle(ScrollEvent event) {
      System.out.println("Rectangle: Scroll started event");
      event.consume();
    }
  });
  
  rect.setOnScrollFinished(new EventHandler&lt;ScrollEvent&gt;() {
    @Override
    public void handle(ScrollEvent event) {
      System.out.println("Rectangle: Scroll finished event");
      event.consume();
    }
  });
  
  rect.setOnZoom(new EventHandler&lt;ZoomEvent&gt;() {
    @Override
    public void handle(ZoomEvent event) {
      rect.setScaleX(rect.getScaleX() * event.getZoomFactor());
      rect.setScaleY(rect.getScaleY() * event.getZoomFactor());
      System.out.println("Rectangle: Zoom event" + ", inertia: "
          + event.isInertia() + ", direct: " + event.isDirect());
  
      event.consume();
    }
  });
  
  rect.setOnZoomStarted(new EventHandler&lt;ZoomEvent&gt;() {
    @Override
    public void handle(ZoomEvent event) {
      System.out.println("Rectangle: Zoom event started");
      event.consume();
    }
  });
  
  rect.setOnZoomFinished(new EventHandler&lt;ZoomEvent&gt;() {
    @Override
    public void handle(ZoomEvent event) {
      System.out.println("Rectangle: Zoom event finished");
      event.consume();
    }
  });
  
  rect.setOnRotate(new EventHandler&lt;RotateEvent&gt;() {
    @Override
    public void handle(RotateEvent event) {
      rect.setRotate(rect.getRotate() + event.getAngle());
      System.out.println("Rectangle: Rotate event" + ", inertia: "
          + event.isInertia() + ", direct: " + event.isDirect());
      event.consume();
    }
  });
  
  rect.setOnRotationStarted(new EventHandler&lt;RotateEvent&gt;() {
    @Override
    public void handle(RotateEvent event) {
      System.out.println("Rectangle: Rotate event started");
      event.consume();
    }
  });
  
  rect.setOnRotationFinished(new EventHandler&lt;RotateEvent&gt;() {
    @Override
    public void handle(RotateEvent event) {
      System.out.println("Rectangle: Rotate event finished");
      event.consume();
    }
  });
  
  rect.setOnSwipeRight(new EventHandler&lt;SwipeEvent&gt;() {
    @Override
    public void handle(SwipeEvent event) {
      System.out.println("Rectangle: Swipe right event");
      event.consume();
    }
  });
  
  rect.setOnSwipeLeft(new EventHandler&lt;SwipeEvent&gt;() {
    @Override
    public void handle(SwipeEvent event) {
      System.out.println("Rectangle: Swipe left event");
      event.consume();
    }
  });
  
  rect.setOnTouchPressed(new EventHandler&lt;TouchEvent&gt;() {
    @Override
    public void handle(TouchEvent event) {
      System.out.println("Rectangle: Touch pressed event");
      event.consume();
    }
  });
  
  rect.setOnTouchReleased(new EventHandler&lt;TouchEvent&gt;() {
    @Override
    public void handle(TouchEvent event) {
      System.out.println("Rectangle: Touch released event");
      event.consume();
    }
  });
  
  rect.setOnMousePressed(new EventHandler&lt;MouseEvent&gt;() {
    @Override
    public void handle(MouseEvent event) {
      if (event.isSynthesized()) {
        System.out.println("Ellipse: Mouse pressed event from touch"
            + ", synthesized: " + event.isSynthesized());
      }
      event.consume();
    }
  });
  
  rect.setOnMouseReleased(new EventHandler&lt;MouseEvent&gt;() {
    @Override
    public void handle(MouseEvent event) {
      if (event.isSynthesized()) {
        System.out.println("Ellipse: Mouse released event from touch"
            + ", synthesized: " + event.isSynthesized());
      }
      event.consume();
    }
  });
  
  primaryStage.setScene(scene);
  primaryStage.show();
    }
  }
  </code></pre>
  
  <ol>
  <li><p>I'm trying to implement an JavaFX application which are able to make
  use of touch events and multi-touch gestures. I'm working with a
  capacitive touch screen-eGalax Touch device, with a EETI eGTouch
  driver (eGTouchD version: 2.5).It connected to a Ubuntu 16.04 LTS PC
  via USB  and created multi-touch events (ABS_MT_SLOT,
  ABS_MT_TRACKING_ID, ABS_MT_POSITION_X, ABS_MT_POSITION_Y) which can
  be read from /dev/input/eventX in the terminal. I have tried a lot
  of methods(include MT4j) to realize it but none of them can
  recognize the touch events.</p>
  
  <p>But under Windows 7, the same code the touch events are recognized, I can swipe, pinch，zoom, etc.
  Now,The zoom in and zoom out events also can realized through mouse scroll event in Ubuntu and Wondows 7.</p></li>
  <li><p>By contrast, I am found that in Windows 7 the java 8 JDK supply a
  jar called java-access-bridge.jar,but in Ubuntu`s JDK it not
  included. Is this the key to the problem?</p></li>
  <li><p>Since I just started to get acquainted with this stuff, I appreciate
  any hint or help.</p></li>
  </ol>