Putting Things Together: Adding GridBagLayout to the Address Application

In our last iteration of the address book application we used GridLayout for the address form pane so that all of the text fields were the same size. That's okay for the name field, which should be about 20 characters, but what about the phone number field, which should be only 13 characters? Left alone, it's about seven characters wider than it needs to be, which is sloppy, not to mention ugly.

To fix the address form pane so that the text fields vary in length but are still flexible across displays, we'll use GridBagLayout to create a 3-by-3 grid. The code to do this is nearly identical to the interactive session explaining GridBagLayout, so you should be able to follow ...

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.