
Mehran Sahami Handout #38
CS 106A November 12, 2007
Section Handout #7: Using Interactors
Based on a handout by Eric Roberts
The purpose of this section is to give you some practice using the kind of interactors you
need for the NameSurfer project in Assignment #6.
The specific example is to build a framework for an interactive design tool that allows the
user to arrange boxes with labels on the window. The starting configuration for the
program presents an empty graphics canvas and a control bar containing a JLabel, a
JTextField, and three JButtons. The window as a whole then looks like this:
The most important operation in the program is to be able to add a new box to the screen,
which you do by typing the name of the box in the JTextField and clicking the Add
button. Doing so creates a new labeled box with that name in the center of the window.
For example, if you entered the string Program in the JTextField and clicked Add, you
would see the following result: