How to develop multi-touch applications in ubuntu 16.04 through javafx? -
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<scrollevent>() { @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<scrollevent>() { @override public void handle(scrollevent event) { system.out.println("rectangle: scroll started event"); event.consume(); } }); rect.setonscrollfinished(new eventhandler<scrollevent>() { @override public void handle(scrollevent event) { system.out.println("rectangle: scroll finished event"); event.consume(); } }); rect.setonzoom(new eventhandler<zoomevent>() { @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<zoomevent>() { @override public void handle(zoomevent event) { system.out.println("rectangle: zoom event started"); event.consume(); } }); rect.setonzoomfinished(new eventhandler<zoomevent>() { @override public void handle(zoomevent event) { system.out.println("rectangle: zoom event finished"); event.consume(); } }); rect.setonrotate(new eventhandler<rotateevent>() { @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<rotateevent>() { @override public void handle(rotateevent event) { system.out.println("rectangle: rotate event started"); event.consume(); } }); rect.setonrotationfinished(new eventhandler<rotateevent>() { @override public void handle(rotateevent event) { system.out.println("rectangle: rotate event finished"); event.consume(); } }); rect.setonswiperight(new eventhandler<swipeevent>() { @override public void handle(swipeevent event) { system.out.println("rectangle: swipe right event"); event.consume(); } }); rect.setonswipeleft(new eventhandler<swipeevent>() { @override public void handle(swipeevent event) { system.out.println("rectangle: swipe left event"); event.consume(); } }); rect.setontouchpressed(new eventhandler<touchevent>() { @override public void handle(touchevent event) { system.out.println("rectangle: touch pressed event"); event.consume(); } }); rect.setontouchreleased(new eventhandler<touchevent>() { @override public void handle(touchevent event) { system.out.println("rectangle: touch released event"); event.consume(); } }); rect.setonmousepressed(new eventhandler<mouseevent>() { @override public void handle(mouseevent event) { if (event.issynthesized()) { system.out.println("ellipse: mouse pressed event touch" + ", synthesized: " + event.issynthesized()); } event.consume(); } }); rect.setonmousereleased(new eventhandler<mouseevent>() { @override public void handle(mouseevent event) { if (event.issynthesized()) { system.out.println("ellipse: mouse released event touch" + ", synthesized: " + event.issynthesized()); } event.consume(); } }); primarystage.setscene(scene); primarystage.show(); } }
i'm trying implement javafx application able make use of touch events , multi-touch gestures. i'm working capacitive touch screen-egalax touch device, eeti egtouch driver (egtouchd version: 2.5).it connected ubuntu 16.04 lts pc via usb , created multi-touch events (abs_mt_slot, abs_mt_tracking_id, abs_mt_position_x, abs_mt_position_y) can read /dev/input/eventx in terminal. have tried lot of methods(include mt4j) realize none of them can recognize touch events.
but under windows 7, same code touch events recognized, can swipe, pinch,zoom, etc. now,the zoom in , zoom out events can realized through mouse scroll event in ubuntu , wondows 7.
by contrast, found in windows 7 java 8 jdk supply jar called java-access-bridge.jar,but in ubuntu`s jdk not included. key problem?
since started acquainted stuff, appreciate hint or help.
Comments
Post a Comment