Read the documentation for the TextField
class and
determine what events are sent when the user types, what kind of
listener can react to those events, and how the listener can react.
Write a short summary that your classmates should be able to understand
and use.
Using your answer from Problem G3-A, write a simple GUI that observes what the user types and capitalizes every letter typed.
Using your answer from Problem G3-A, write a simple GUI that reads in a password typed in a text field, putting some special symbol in the field in place of each character typed.
Java provides a setSize
method for text fields as well
as for other components. Read and report on the use and abuse of this
method. Can you use it to create a blank field, as we needed in
Experiment G3.2?
Build a new graphical user interface class, Calculator
,
which displays eleven buttons corresponding to the ten decimal digits
(0, 1, ..., 9) and clear. Your class should also display a field.
When the user clicks on a digit, you should add it to the end of the
field.
Extend your Calculator
class to support an
add
and equals
button. The
add
button should remember the current value
in the display field and clear that field. The equals
button should add the contents of the display field and added it
to the remembered value. If this seems odd to you, consider the
interface for a typical desktop calculator.
[Front Door] [Introduction] [Code]
Copyright (c) 1998 Samuel A. Rebelsky. All rights reserved.
Source text last modified Mon Oct 25 23:29:32 1999.
This page generated on Tue Oct 26 15:38:01 1999 by Siteweaver.
Contact our webmaster at rebelsky@math.grin.edu