UI Actions
UI Actions
- User Interface components generate events called actions
- Override action() method to capture these events
- Requires the developer to test which UI component generated the event
- public boolean action(Event e, Object arg) { ... }
- Different UI components generate different actions and pass different objects
- Example
public boolean action(Event e, Object arg) { if (e.target instanceof Button) clickedButton(arg); else if (e.target instanceof Choice) menuChoice(arg); return true;}