ITSE 2317 OOP LectureTitle Lecture # zz Run: Tue Aug 14 22:32:20 CDT 2012 Baldwin Slides aa - ITSE 2317 Java Programming (Intermediate) ab - Anonymous Classes ac - Figures ad - Listings ae - What can you include in a class definition? af - Explain anonymous classes ag - What is an anonymous class? ah - Continuing with Nutshell ai - Miscellaneous info aj - What about an anonymous interface? ak - Why use anonymous classes? al - The most important benefit am - Access to final local variables an - Can be particularly useful when... ao - Purpose of this lesson ap - Anonymous classes versus local classes aq - Cannot define a constructor ar - Only one object as - Cannot contain static members at - No public, private, etc. au - Copies of local variables av - Smoke and mirrors aw - Syntax for anonymous classes ax - What does the first expression mean? ay - What about constructor parameters? az - Passing parameters to the superclass constructor ba - Usage bb - What about instantiating an interface? bc - Instantiating an interface? (cont'd) bd - The correct interpretation be - The result bf - What about constructor parameters? bg - Let's see some code bh - The program output bi - Program classes bj - Class file names bk - Are they really anonymous? bl - Program structure and behavior bm - A local class bn - An anonymous class with an instance initializer bo - Compare with local class bp - An anonymous class that implements an interface bq - An anonymous class that extends an existing class br - The screen output bs - Terminate the program bt - The controlling class bu - Local and anonymous classes inside GUI constructor bv - Output produced by constructors and instance initializers bw - The GUI class bx - Beginning of GUI class by - Beginning of the BaldButton class bz - Why extend Button? ca - Enable mouse events cb - The remaining constructor code cc - The screen output cd - The processMouseEvent method ce - Different kinds of mouse events cf - Ignore all but MOUSE_CLICKED cg - Call processMouseEvent on the superclass ch - Add a button to the frame ci - Could instantiate multiple buttons of this type cj - An interesting restriction ck - An anonymous inner class for low-level event handling cl - Anonymous inner class extends Button cm - An argument to the add method cn - Extends the Button class co - An instance initializer cp - The screen output cq - Remaining code cr - Overridden processMouseEvent method cs - Same code as before ct - Implementing a listener interface cu - Instantiating and registering a MouseListener object cv - No requirement to extend Button cw - Register a mouse listener on the button cx - Instantiate the listener object cy - Implement the MouseListener interface cz - An instance initializer da - The output db - Similar class file names dc - Implementing the interface dd - Define mouseClicked method de - Define remaining methods df - Separation of event subcategories dg - Separation (cont'd) dh - Separation (cont'd) di - When the button fires a mouse event ... dj - Invocation of an empty method dk - What about mouseMoved and mouseDragged? dl - Add the button to the frame dm - A disclaimer dn - Extending the WindowAdapter class do - The WindowAdapter class dp - The screen output dq - Class file names dr - Class file names (cont'd) ds - The windowClosing method dt - Calling the windowClosing method du - Window closing (cont'd) dv - A different approach in Swing dw - The remaining code dx - The GUI remains on the screen until terminated dy - Simple event handlers dz - Summary ea - Complete program listing eb - The end |
-end-