Skip to content

Instantly share code, notes, and snippets.

@Bigigrammer
Last active October 16, 2017 16:49
Show Gist options
  • Save Bigigrammer/d2a0d1d1fd535ee1ce1aeddb93cbf1d5 to your computer and use it in GitHub Desktop.
Save Bigigrammer/d2a0d1d1fd535ee1ce1aeddb93cbf1d5 to your computer and use it in GitHub Desktop.
EventListener_Java
public class EventBeginning{
private ListenerInterface listener = null;
public void eventListener() {
if (listener != null) {
listener.buttonAction();
}
}
public void addListener(ListenerInterface listener) {
this.listener = listener;
}
}
import java.util.EventListener;
public interface ListenerInterface extends EventListener{
public void buttonAction();
}
public class ReciveEvent implements ListenerInterface{
EventBeginning childClass;
public ReciveEvent{
childClass = new EventBeginning();
childClass.addListener(this);
}
public static void main(String[] args) {
}
@Override
public void buttonAction(){
// TODO Auto-generated method stub
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment