This page provides links to a few demo programs from class #4 (30 Sept).
ColorButtons.java illustrates an anonymous inner class and the ActionListener interface. The running program looks like:
ManyPanels.java shows how several ButtonPanels (from the previous example) can be instantiated, with each maintaining its own state. Here's a screen shot of the program in action:
WindowWatcher.java shows an implementation of the WindowListener interface. The program behaves identically to ColorButtons.java, but also prints a "stream of consciousness" of window events as it is activated, deactivated, iconified, and so forth. Here's a sample run:
D:\CIS370\Web\demo\class04>javac WindowWatcher.java D:\CIS370\Web\demo\class04>java WindowWatcher Activated. Opened. Deactivated. Activated. Iconified. Deactivated. Deiconified. Activated. Closing. D:\CIS370\Web\demo\class04>