Last active
October 16, 2017 16:49
-
-
Save Bigigrammer/d2a0d1d1fd535ee1ce1aeddb93cbf1d5 to your computer and use it in GitHub Desktop.
EventListener_Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EventBeginning{ | |
private ListenerInterface listener = null; | |
public void eventListener() { | |
if (listener != null) { | |
listener.buttonAction(); | |
} | |
} | |
public void addListener(ListenerInterface listener) { | |
this.listener = listener; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.EventListener; | |
public interface ListenerInterface extends EventListener{ | |
public void buttonAction(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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