Adding an Input Form for an Address Entry: The Prototype

In an interactive session, let's create a GUI form that can edit an address entry. We want a frame that holds text field components, which will be used to gather the address information. We also want an OK button, which signifies that the user is done entering the current address.

To get the layout for the frame components, we'll use a technique that layers components in a container. For this we'll put the text fields in one panel and the OK button in another. The panels themselves are components that we'll put in the frame.

The first thing we need to do is import the JFrame, JButton, and JTextField classes from javax.swing.

 >>> from javax.swing import JFrame >>> from javax.swing import ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.