All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.TextField

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.TextComponent
                   |
                   +----java.awt.TextField

public class TextField
extends TextComponent
TextField is a component that allows the editing of a single line of text.


Constructor Index

 o TextField()
Constructs a new TextField.
 o TextField(int)
Constructs a new empty TextField with the specified number of columns.
 o TextField(String)
Constructs a new TextField initialized with the specified text.
 o TextField(String, int)
Constructs a new TextField initialized with the specified text and columns.

Method Index

 o addActionListener(ActionListener)
Adds the specified action listener to recieve action events from this textfield.
 o addNotify()
Creates the TextField's peer.
 o echoCharIsSet()
Returns true if this TextField has a character set for echoing.
 o getColumns()
Returns the number of columns in this TextField.
 o getEchoChar()
Returns the character to be used for echoing.
 o getMinimumSize()
Returns the minimum size Dimensions needed for this TextField.
 o getMinimumSize(int)
Returns the minimum size Dimensions needed for this TextField with the specified amount of columns.
 o getPreferredSize()
Returns the preferred size Dimensions needed for this TextField.
 o getPreferredSize(int)
Returns the preferred size Dimensions needed for this TextField with the specified amount of columns.
 o minimumSize()
Deprecated.
 o minimumSize(int)
Deprecated.
 o paramString()
Returns the String of parameters for this TextField.
 o preferredSize()
Deprecated.
 o preferredSize(int)
Deprecated.
 o processActionEvent(ActionEvent)
Processes action events occurring on this textfield by dispatching them to any registered ActionListener objects.
 o processEvent(AWTEvent)
Processes events on this textfield.
 o removeActionListener(ActionListener)
Removes the specified action listener so that it no longer receives action events from this textfield.
 o setColumns(int)
Sets the number of columns in this TextField.
 o setEchoChar(char)
Sets the echo character for this TextField.
 o setEchoCharacter(char)
Deprecated.

Constructors

 o TextField
 public TextField()
Constructs a new TextField.

 o TextField
 public TextField(String text)
Constructs a new TextField initialized with the specified text.

Parameters:
text - the text to be displayed
 o TextField
 public TextField(int columns)
Constructs a new empty TextField with the specified number of columns.

Parameters:
columns - the number of columns
 o TextField
 public TextField(String text,
                  int columns)
Constructs a new TextField initialized with the specified text and columns.

Parameters:
text - the text to be displayed
columns - the number of columns

Methods

 o addNotify
 public void addNotify()
Creates the TextField's peer. The peer allows us to modify the appearance of the TextField without changing its functionality.

Overrides:
addNotify in class Component
 o getEchoChar
 public char getEchoChar()
Returns the character to be used for echoing.

See Also:
setEchoChar, echoCharIsSet
 o setEchoChar
 public void setEchoChar(char c)
Sets the echo character for this TextField. This is useful for fields where the user input shouldn't be echoed to the screen, as in the case of a TextField that represents a password.

Parameters:
c - the echo character for this TextField
See Also:
echoCharIsSet, getEchoChar
 o setEchoCharacter
 public void setEchoCharacter(char c)
Note: setEchoCharacter() is deprecated. As of JDK version 1.1, replaced by setEchoChar(char).

 o echoCharIsSet
 public boolean echoCharIsSet()
Returns true if this TextField has a character set for echoing.

See Also:
setEchoChar, getEchoChar
 o getColumns
 public int getColumns()
Returns the number of columns in this TextField.

 o setColumns
 public void setColumns(int columns)
Sets the number of columns in this TextField.

Parameters:
columns - the number of columns
Throws: IllegalArgumentException
If columns is less than 0.
 o getPreferredSize
 public Dimension getPreferredSize(int columns)
Returns the preferred size Dimensions needed for this TextField with the specified amount of columns.

Parameters:
columns - the number of columns in this TextField
 o preferredSize
 public Dimension preferredSize(int columns)
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize(int).

 o getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred size Dimensions needed for this TextField.

Overrides:
getPreferredSize in class Component
 o preferredSize
 public Dimension preferredSize()
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize().

Overrides:
preferredSize in class Component
 o getMinimumSize
 public Dimension getMinimumSize(int columns)
Returns the minimum size Dimensions needed for this TextField with the specified amount of columns.

Parameters:
columns - the number of columns in this TextField
 o minimumSize
 public Dimension minimumSize(int columns)
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize(int).

 o getMinimumSize
 public Dimension getMinimumSize()
Returns the minimum size Dimensions needed for this TextField.

Overrides:
getMinimumSize in class Component
 o minimumSize
 public Dimension minimumSize()
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize().

Overrides:
minimumSize in class Component
 o addActionListener
 public synchronized void addActionListener(ActionListener l)
Adds the specified action listener to recieve action events from this textfield.

Parameters:
l - the action listener
 o removeActionListener
 public synchronized void removeActionListener(ActionListener l)
Removes the specified action listener so that it no longer receives action events from this textfield.

Parameters:
l - the action listener
 o processEvent
 protected void processEvent(AWTEvent e)
Processes events on this textfield. If the event is an ActionEvent, it invokes the processActionEvent method, else it invokes its superclass's processEvent.

Parameters:
e - the event
Overrides:
processEvent in class TextComponent
 o processActionEvent
 protected void processActionEvent(ActionEvent e)
Processes action events occurring on this textfield by dispatching them to any registered ActionListener objects. NOTE: This method will not be called unless action events are enabled for this component; this happens when one of the following occurs: a) An ActionListener object is registered via addActionListener() b) Action events are enabled via enableEvents()

Parameters:
e - the action event
See Also:
enableEvents
 o paramString
 protected String paramString()
Returns the String of parameters for this TextField.

Overrides:
paramString in class TextComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature