Answer the question
In order to leave comments, you need to log in
Why doesn't adding an EventHandler from this (error) work?
Why doesn't this work? (gives an error)
Class UIItem implements EventHandler<MouseEvent>{
public <E extends Event> void addEventHandler(EventType<E> eventType){
treeItem.addEventHandler(eventType, this);
}
@Override
public void handle(MouseEvent mouseEvent) {
System.out.println("EVENT");
}
}
Class UIItem implements EventHandler<MouseEvent>{
public <E extends Event> void addEventHandler(EventType<E> eventType){
treeItem.addEventHandler(eventType, (EventHandler<E>) this);
}
@Override
public void handle(MouseEvent mouseEvent) {
System.out.println("EVENT");
}
}
Class UIItem implements EventHandler<MouseEvent>{
public <E extends Event> void addEventHandler(EventType<E> eventType){
treeItem.getValue().addEventHandler(eventType, (EventHandler<E>) this);
}
@Override
public void handle(MouseEvent mouseEvent) {
System.out.println("EVENT");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question