CS 18000 Chapter Notes - Chapter 15: Layout Manager

37 views2 pages

Document Summary

One-to-one: one event source sends to one listener, simple. Many-to-one: many event sources send to one listener, allows single piece of code to handle multiple buttons. One-to-many: one sources send to many listeners, less used, but allows independent actions on same button press. Technique 1: creates a named class that implements actionlistener. Attach object to one or more buttons. Technique 2: create an object of a nested class and attach to a button. Technique 3: create an object of an unnamed (anonymous inner) class and attach to a button. Declare the method, class, create object, and add action listener all in one step. Problem: some interfaces have many methods, your use may only need one of them, interface requires implementations for all. Solution: adapter class provides default (empty) implementations for all, you create a subclass of the adapter class, overriding the ones you want to change.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents