A TextField object is a text component
that allows for the editing of a single line of text.
For example, the following image depicts a frame with four
text fields of varying widths. Two of these text fields
display the predefined text "Hello".
Here is the code that produces these four text fields:
TextField tf1, tf2, tf3, tf4;
// a blank text field
tf1 = new TextField();
// blank field of 20 columns
tf2 = new TextField("", 20);
// predefined text displayed
tf3 = new TextField("Hello!");
// predefined text in 30 columns
tf4 = new TextField("Hello", 30);
Every time the user types a key in the text field, AWT
sends two action events to the text field. The first
one represents the key press and the second one,
the key release. Each action event embodies the state
of the system at the time that some action occurred.
The properties of an action event indicate which
key was pressed, what modifier keys were also pressed,
and the time at which the event occurred.
Since the event is an instance of ActionEvent,
the TextField class's processEvent
method examines the event and passes it along to
processActionEvent. The latter method redirects the
event to any ActionListener objects that have
registered an interest in action events generated by this
text field.
Gets the character that is to be used for echoing.
An echo character is useful for text fields where
user input should not be echoed to the screen, as in
the case of a text field for entering a password.
An echo character is useful for text fields where
user input should not be echoed to the screen, as in
the case of a text field for entering a password.
Indicates whether or not this text field has a
character set for echoing.
An echo character is useful for text fields where
user input should not be echoed to the screen, as in
the case of a text field for entering a password.
Returns:
true if this text field has
a character set for echoing;
false otherwise.
Processes events on this text field. If the event
is an instance of ActionEvent,
it invokes the processActionEvent
method. Otherwise, it invokes processEvent
on the superclass.
Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.