O'Reilly logo

Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython by Richard Hightower

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Transforming the Address Book Application into an Applet

What we're going to do is convert AddressMain, which is currently a form, into an applet. Later we'll make changes to AddressModel so that it can deal with URLs instead of files. This means that it will be able to read and write to any files to which it refers, including any file transmitted over the HTTP protocol.

Changes to AddressMain

First let's make it so AddressMain derives from an applet instead of a frame.

class AddressMain(JApplet):

Now let's add the __init__ and __destroy__ methods. __init__ gives us access to the database, which we need to initialize AddressModel. __destroy__ calls AddressModel's writeAddress() function, which writes addresses out to a file (if the protocol ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required