我正在尝试双击ListView上的某个项目然后应该发生一些事情。虽然我在这里找到了一些解决方案,并且发现了一个有这个确切错误的帖子,但我自己真的无法自己解决。
我的示例代码:
public class MainTest {
public static void main(String[] args) {
new test();
}
}
public class Test extends AnchorPane implements EventHandler<ActionEvent>{
private ListView<String> list = new ListView<String>();
public Test() {
super();
list.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
}
});
}
}
我需要EventHandler<ActionEvent>
按钮。
完整错误:
Type argument MousEvent is not within bounds of type-variable T where T is a type-variable: T extends Event declared in interface EventHandler incompatible types: <anonymous EventHandler<java.awt.event.MouseEvent>> cannot be converted to EventHandler<? super javafx.scene.input.MouseEvent>