Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Component {
- private List<ActionListener> listeners = new ArrayList<ActionListener>();
- public void addActionListener(ActionListener listener, String... args) {
- System.out.println(Arrays.asList(args));
- listeners.add(listener);
- }
- public void triggerAction(String action) {
- for (ActionListener listener: listeners) {
- listener.onAction(action, true, 42);
- }
- }
- }
Add Comment
Please, Sign In to add comment