2

Using my ThinkPad touch pad, I can zoom in and out on various applications with a pinch gesture, just as I do with other zoom methods, such as Ctrl+Mouse Wheel.

Is it possible to listen to such gestures in java, and dispatch a zoom event to my application?

Elist
  • 5,313
  • 3
  • 35
  • 73

2 Answers2

0

will this help?

SmoothPinchZoom

RuntimeError
  • 105
  • 1
  • 9
0

I had the same problem - although there's no detail of what kind of component you are considering, for a javafx webview this should work: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/input/ZoomEvent.html

webView.addEventFilter(ZoomEvent.ZOOM, (ZoomEvent e) -> {
    double zoom = e.getZoomFactor();
    webView.setZoom(webView.getZoom() * zoom);
    e.consume();
});
Yost777
  • 597
  • 1
  • 6
  • 19