2 Replies Latest reply on Mar 30, 2013 2:09 AM by KonradZuse

    Swipe Right

    895675
      I have a AnchorPane and I am using the Swipe Right, when I to click and hold the mouse over the AnchorPane and move to the right, need to change the page, my code is this, but is not working:
      AnchorPane.setOnSwipeRight(new EventHandler<SwipeEvent> () {
      
         @Override
         public void handle(SwipeEvent event) {
            pagination = PaginationBuilder.create().pageCount(qtdPagina()).pageFactory(new Callback<Integer, Node>() {           
               @Override 
                public Node call(Integer pageIndex) {
                   return createAnimalPage(pagination.getCurrentPageIndex() + 1);
                }
            }).build();
                      event.consume();
         }
                          
      });
      Could anyone help me?
      Thanks!

      Edited by: 892672 on 29/03/2013 15:16

      Edited by: 892672 on 29/03/2013 15:16
        • 1. Re: Swipe Right
          jsmith
          I think swiping is for touch events, not mouse events - try it on a touch capable device such as a touch screen or touch pad.
          • 2. Re: Swipe Right
            KonradZuse
            JSmith is correct, this is ONLY for touch devices, you want mouseDragged.

            I do believe you could set it up for a mouse movement right by doing
             
            mousePressed(MouseEvent evt)
             {
                x = evt.getSceneX();
                y = evt.getSceneY();
            }
            
            mouseDragged(MouseEvent evt)
            {
            if(x <evt.getSceneX())
            {
            
            //do something
            
            }