Guest User

Untitled

a guest
Sep 18th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Component {
  4. private List<ActionListener> listeners = new ArrayList<ActionListener>();
  5.  
  6. public void addActionListener(ActionListener listener, String... args) {
  7. System.out.println(Arrays.asList(args));
  8. listeners.add(listener);
  9. }
  10.  
  11. public void triggerAction(String action) {
  12. for (ActionListener listener: listeners) {
  13. listener.onAction(action, true, 42);
  14. }
  15. }
  16. }
Add Comment
Please, Sign In to add comment