Java 类javafx.scene.input.SwipeEvent 实例源码

项目:JavaFX-SWT-Gesture-Bridge    文件:SwtToFXGestureConverter.java   
private void sendSwipeEvent(final GestureEvent event,
                TKSceneListener sceneListener) {
        Point screenPosition = canvas.toDisplay(event.x, event.y);
        EventType<SwipeEvent> fxEventType = null;
        if(event.yDirection > 0)
            fxEventType = SwipeEvent.SWIPE_DOWN;
        else if(event.yDirection < 0) 
            fxEventType = SwipeEvent.SWIPE_UP;
        else if(event.xDirection > 0)
            fxEventType = SwipeEvent.SWIPE_RIGHT;
        else if(event.xDirection < 0) 
            fxEventType = SwipeEvent.SWIPE_LEFT;
//      System.out.println(fxEventType.toString());
        sceneListener.swipeEvent(fxEventType,
                0,                  // touch
                event.x, event.y,   // x, y
                screenPosition.x, screenPosition.y, // screenX, screenY
                isShift(event), isControl(event), isAlt(event), isMeta(event), 
                false);             // direct 
    }
项目:Gargoyle    文件:DockTabPaneSkin.java   
private void initializeSwipeHandlers() {
    if (IS_TOUCH_SUPPORTED) {
        getSkinnable().addEventHandler(SwipeEvent.SWIPE_LEFT, t -> {
            getBehavior().selectNextTab();
        });

        getSkinnable().addEventHandler(SwipeEvent.SWIPE_RIGHT, t -> {
            getBehavior().selectPreviousTab();
        });
    }
}
项目:JacpFX-misc    文件:PerspectiveOne.java   
@Override
public void handlePerspective(final Message<Event, Object> action,
                              final PerspectiveLayout perspectiveLayout) {
    if (action.messageBodyEquals(FXUtil.MessageUtil.INIT)) {
        mainLayout = new SplitPane();
        mainLayout.setEffect(new DropShadow());
        mainLayout.setOrientation(Orientation.HORIZONTAL);
        mainLayout.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
        mainLayout.setDividerPosition(0, 0.55f);

        // create left button menu
        GridPane leftMenu = new GridPane();
        // create main content Top
        GridPane mainContent = new GridPane();

        // let them grow
        GridPaneUtil.setFullGrow(ALWAYS, leftMenu);
        GridPaneUtil.setFullGrow(ALWAYS, mainContent);
        GridPaneUtil.setFullGrow(ALWAYS, mainLayout);

        mainLayout.getItems().addAll(leftMenu, mainContent);
        // Register root component
        perspectiveLayout.registerRootComponent(mainLayout);
        // register left menu
        perspectiveLayout.registerTargetLayoutComponent(TARGET_CONTAINER_LEFT, leftMenu);
        // register main content
        perspectiveLayout.registerTargetLayoutComponent(TARGET_CONTAINER_MAIN, mainContent);

        EventHandler<SwipeEvent> swipeHandler = new EventHandler<SwipeEvent>() {
            @Override
            public void handle(SwipeEvent swipeEvent) {
                System.out.println("SWIPE");
            }
        };

        mainLayout.setOnSwipeLeft(swipeHandler);
        mainLayout.setOnSwipeRight(swipeHandler);
        mainLayout.setOnSwipeDown(swipeHandler);
        mainLayout.setOnSwipeUp(swipeHandler);

    }

}