Putting Things Together—Adding a Table Model to the Address Book Application

In this section, we'll add a table model to the address book application and “swingify” some of the application's AWT ways.

AWT to JFC

The first time I wrote the address book application, I used all of the old AWT components (java.awt.Frame, java.awt.Panel, etc.). When I modified it, only 12 lines out of 114 had to be changed, and 9 of those dealt with JList.

The point is that the move from List to JList changed a lot, although most of the changes weren't needed. Other JFC/AWT components map nicely even though they're not closely related on the class hierarchy. Luckily, JList is the exception, not the rule.

Up to now what we've seen of JFC/Swing is pretty much the same ...

Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.