Consider the following example:
public class Sandbox {
public interface Listener {
public void onEvent(T event);
No. You cant. It's because generics are supported only at compiler level. So you can't do thinks like
public interface AnotherInterface {
public void onEvent(List event);
public void onEvent(List event);
}
or implements interface with several parameters.
upd
I think workaround will be like this:
public class Sandbox {
// ....
public final class JPanelEventHandler implements Listener {
AnotherInterface target;
JPanelEventHandler(AnotherInterface target){this.target = target;}
public final void onEvent(JPanel event){
target.onEvent(event);
}
}
///same with JLabel
}