Held Thursday, September 23, 1999
Today, you will continue your investigation of graphical programs
that use Java's Abstract Windowing Toolkit. In particular,
you will build event-driven programs that include buttons and text fields.
- There's still time to sign up for the picnic. The sign-up sheet
is next to my door.
- The ACM Chapter meeting will be Sunday at 2:00 in the room next
to the MathLAN. Contact Joey Lesh (
firstname.lastname@example.org) for more information.
- You've been assigned teams and
subprojects. For next Wednesday, each team should prepare
a summary of the objects they plan to create and the methods
they will support.
- The GUI groups should also have sketches of their interfaces.
- Any final questions on exam 1?
- A few of you have asked how you might find the errors in
problem C. One possibility is to print out a message at each
step to tell what's happening.
- Some of you have asked me how you might convert
doubles (although I'm not sure why). As we've
discussed in the past, you should use something like
double d = (new Double(___)).doubleValue();
Double bigD = new Double(___);
double d = bigD.doubleValue();
- No, you do not have to write code for question 2. You should,
however, identify all the parameters of all your methods.
- Once again, we'll focus on the lab, with a short time for reflection
- Graphical User Interfaces
- The event-driven model
- Using components
- Lab: G2
- Read G3 for tomorrow.
- For next Wednesday, develop an initial interface for all the
classes you expect to include in your component of the project.
Turn in compilable files. GUI teams should also sketch the
windows they expect to show.
Do as much of G2.1 through G2.4 as you can. (You should finish up
the rest in the evening.)
- Although many of the programs we've been writing are text-based,
most modern programs use a graphical user interface (GUI).
- Java's included toolkits for building GUIs since the early versions.
- Unfortunately, these toolkits have changed substantially as
Java evolved from 1.0 to 1.1 and from 1.1 to 1.2.
- We'll focus on the Abstract Windowing Toolkit (awt) as it is supported
in Java 1.1 and Java 1.2.
- Java 1.2 add Swing, but Swing is not yet fully supported on our
- GUIs use an event-driven programming model. We might also
call this a reactive model.
- Rather than using an imperative model in which your
program says step-by-step what do do, reactive programs have
event handlers which basically say ``when this happens,
- You'll still need a
main method to create the objects
which supply these event handlers.
- As you might guess, GUIs have a number of components (menus, buttons,
labels, etc.). In Java, each component is an object.
- We put components into windows and frames using the
- Each component can have one or more listeners that respond
to the events that pertain to the object. (You should have read
something about this in chapter 1 of Java Plus Data Structures.)
- The rest of the details are in the lab.
Tuesday, 10 August 1999
- Created as a blank outline.
Wednesday, 22 September 1999
- Filled in the details (such as they are).
Thursday, 23 September 1999
- Added a few more introductory notes.
Back to Building Graphical Programs.
On to Java's AWT, Continued.