java.awt
public class TextField extends TextComponent
Nested Class Summary | |
---|---|
protected class | TextField.AccessibleAWTTextField |
Constructor Summary | |
---|---|
TextField()
Initializes a new instance of TextField that is empty
and has one column.
| |
TextField(String text)
Initializes a new instance of TextField containing
the specified text. | |
TextField(int columns)
Initializes a new instance of TextField that is empty
and has the specified number of columns.
| |
TextField(String text, int columns)
Initializes a new instance of TextField with the
specified text and number of columns.
|
Method Summary | |
---|---|
void | addActionListener(ActionListener listener)
Addes a new listener to the list of action listeners for this
object.
|
void | addNotify()
Notifies this object that it should create its native peer. |
boolean | echoCharIsSet()
Tests whether or not this text field has an echo character set
so that characters the user type are not echoed to the screen.
|
AccessibleContext | getAccessibleContext() |
ActionListener[] | getActionListeners()
Return all ActionListeners register to this TextField object
as an array.
|
int | getColumns()
Returns the number of columns in the field.
|
char | getEchoChar()
Returns the character that is echoed to the screen when a text
field is protected (such as when a password is being entered).
|
<T extends EventListener> T[] | getListeners(Class<T> listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this TextField . |
Dimension | getMinimumSize()
Returns the minimum size for this text field.
|
Dimension | getMinimumSize(int columns)
Returns the minimum size of a text field with the specified number
of columns.
|
Dimension | getPreferredSize()
Returns the preferred size for this text field.
|
Dimension | getPreferredSize(int columns)
Returns the preferred size of a text field with the specified number
of columns.
|
Dimension | minimumSize()
Returns the minimum size for this text field.
|
Dimension | minimumSize(int columns)
Returns the minimum size of a text field with the specified number
of columns.
|
protected String | paramString()
Returns a debug string for this object.
|
Dimension | preferredSize()
Returns the preferred size for this text field.
|
Dimension | preferredSize(int columns)
Returns the preferred size of a text field with the specified number
of columns.
|
protected void | processActionEvent(ActionEvent event)
Processes an action event by calling any registered listeners.
|
protected void | processEvent(AWTEvent event)
Processes the specified event. |
void | removeActionListener(ActionListener listener)
Removes the specified listener from the list of action listeners
for this object.
|
void | setColumns(int columns)
Sets the number of columns in this field to the specified value.
|
void | setEchoChar(char echoChar)
Sets the character that is echoed when protected input such as
a password is displayed.
|
void | setEchoCharacter(char echoChar)
Sets the character that is echoed when protected input such as
a password is displayed.
|
TextField
that is empty
and has one column.
Throws: HeadlessException If GraphicsEnvironment.isHeadless() is true,
TextField
containing
the specified text. The number of columns will be equal to the
length of the text string.
Parameters: text The text to display in the field.
Throws: HeadlessException If GraphicsEnvironment.isHeadless() is true,
TextField
that is empty
and has the specified number of columns.
Parameters: columns The number of columns in the text field.
Throws: HeadlessException If GraphicsEnvironment.isHeadless() is true,
TextField
with the
specified text and number of columns.
Parameters: text The text to display in the field. columns The number of columns in the field.
Throws: HeadlessException If GraphicsEnvironment.isHeadless() is true,
Parameters: listener The listener to add to the list.
Returns: true
if an echo character is set,
false
otherwise.
TextField
object
as an array.
Since: 1.4
Returns: The number of columns in the field.
Returns: The echo character for this text field.
TextField
. FooListeners are registered using the
addFooListener method.
Throws: ClassCastException If listenerType doesn't specify a class or interface that implements java.util.EventListener.
Since: 1.3
Returns: The minimum size for this text field.
Parameters: columns The number of columns to get the minimum size for.
Returns: The preferred size for this text field.
Parameters: columns The number of columns to get the preferred size for.
Deprecated: This method is deprecated in favor of
getMinimumSize()
.
Returns: The minimum size for this text field.
Deprecated: This method is deprecated in favor of
getMinimumSize(int)
.
Parameters: columns The number of columns to get the minimum size for.
Returns: A debug string for this object.
Deprecated: This method is deprecated in favor of
getPreferredSize()
.
Returns: The preferred size for this text field.
Deprecated: This method is deprecated in favor of
getPreferredSize(int)
.
Parameters: columns The number of columns to get the preferred size for.
enableEvents()
.
Parameters: event The event to process.
ActionEvent
then processActionEvent()
is
called to process it, otherwise the event is sent to the
superclass.
Parameters: event The event to process.
Parameters: listener The listener to remove from the list.
Parameters: columns The new number of columns in the field.
Throws: IllegalArgumentException If columns is less than zero.
Parameters: echoChar The new echo character.
Deprecated: This method is deprecated in favor of
setEchoChar()
Parameters: echoChar The new echo character.