mouseevent在java fx中不起作用

时间:2017-04-07 14:26:55

标签: gradle javafx

我正在使用intelj在Gradle中创建一个Javafx应用程序 在groovy和java中我在java中写了FXml控制器类所以这里的错误

    JFXHamburger h1 = new JFXHamburger();
    HamburgerSlideCloseTransition burgerTask = new 
    HamburgerSlideCloseTransition(h1);
    burgerTask.setRate(-1);
    h1.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{
   burgerTask.setRate(burgerTask.getRate()*-1);
    burgerTask.play();
  }); 

我做了相同的文档我得到这个MeSsasge

       Error:(31, 18) java: method addEventHandler in class   
      javafx.scene.Node cannot be applied to given types;
    required: javafx.event.EventType<T>,javafx.event.EventHandler<? 
       superT>
     found: int,(e)->{ bur[...](); }
      reason: cannot infer type-variable(s) T
(argument mismatch; int cannot be converted to javafx.event.EventType<T>)

0 个答案:

没有答案