The following code:
public void addGrillaListener(Stage stageToClose,Grilla listener)
{
GrillaHandler<WindowEvent> handy = new GrillaHandler<>(listener);
if(stageToClose!=null)
{
stageToClose.addEventHandler(WindowEvent.WINDOW_HIDDEN,handy);
}
}
causes the compiler to show that message. How can I avoid it?
Extra info:
GrillaHandler:
public class GrillaHandler<T> implements EventHandler {
private Grilla win;
public GrillaHandler(Grilla win) {
this.win=win;
}
@Override
public void handle(Event t) {
win.loadTable();
}
}
Grilla:
public interface Grilla {
public void loadTable();
}
Change code to
public class GrillaHandler<T extends Event> implements EventHandler<T>{
//...
}
The JavaFX EventHandler is a paremeterized type. You are missing that one in your declaration of the GrillaHandler
. You are forced to provide a type argument in your class declaration or redeclare the type parameter, as you seem to require as per your declaration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With