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.
-
TextField()
- Constructs a new TextField.
-
TextField(int)
- Constructs a new empty TextField with the specified number of columns.
-
TextField(String)
- Constructs a new TextField initialized with the specified text.
-
TextField(String, int)
- Constructs a new TextField initialized with the specified text
and columns.
-
addActionListener(ActionListener)
- Adds the specified action listener to recieve
action events from this textfield.
-
addNotify()
- Creates the TextField's peer.
-
echoCharIsSet()
- Returns true if this TextField has a character set for
echoing.
-
getColumns()
- Returns the number of columns in this TextField.
-
getEchoChar()
- Returns the character to be used for echoing.
-
getMinimumSize()
- Returns the minimum size Dimensions needed for this TextField.
-
getMinimumSize(int)
- Returns the minimum size Dimensions needed for this TextField
with the specified amount of columns.
-
getPreferredSize()
- Returns the preferred size Dimensions needed for this TextField.
-
getPreferredSize(int)
- Returns the preferred size Dimensions needed for this TextField
with the specified amount of columns.
-
minimumSize()
-
Deprecated.
-
minimumSize(int)
-
Deprecated.
-
paramString()
- Returns the String of parameters for this TextField.
-
preferredSize()
-
Deprecated.
-
preferredSize(int)
-
Deprecated.
-
processActionEvent(ActionEvent)
-
Processes action events occurring on this textfield by
dispatching them to any registered ActionListener objects.
-
processEvent(AWTEvent)
- Processes events on this textfield.
-
removeActionListener(ActionListener)
- Removes the specified action listener so that it no longer
receives action events from this textfield.
-
setColumns(int)
- Sets the number of columns in this TextField.
-
setEchoChar(char)
- Sets the echo character for this TextField.
-
setEchoCharacter(char)
-
Deprecated.
TextField
public TextField()
- Constructs a new TextField.
TextField
public TextField(String text)
- Constructs a new TextField initialized with the specified text.
- Parameters:
- text - the text to be displayed
TextField
public TextField(int columns)
- Constructs a new empty TextField with the specified number of columns.
- Parameters:
- columns - the number of columns
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
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
getEchoChar
public char getEchoChar()
- Returns the character to be used for echoing.
- See Also:
- setEchoChar, echoCharIsSet
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
setEchoCharacter
public void setEchoCharacter(char c)
- Note: setEchoCharacter() is deprecated.
As of JDK version 1.1,
replaced by setEchoChar(char).
echoCharIsSet
public boolean echoCharIsSet()
- Returns true if this TextField has a character set for
echoing.
- See Also:
- setEchoChar, getEchoChar
getColumns
public int getColumns()
- Returns the number of columns in this TextField.
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.
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
preferredSize
public Dimension preferredSize(int columns)
- Note: preferredSize() is deprecated.
As of JDK version 1.1,
replaced by getPreferredSize(int).
getPreferredSize
public Dimension getPreferredSize()
- Returns the preferred size Dimensions needed for this TextField.
- Overrides:
- getPreferredSize in class Component
preferredSize
public Dimension preferredSize()
- Note: preferredSize() is deprecated.
As of JDK version 1.1,
replaced by getPreferredSize().
- Overrides:
- preferredSize in class Component
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
minimumSize
public Dimension minimumSize(int columns)
- Note: minimumSize() is deprecated.
As of JDK version 1.1,
replaced by getMinimumSize(int).
getMinimumSize
public Dimension getMinimumSize()
- Returns the minimum size Dimensions needed for this TextField.
- Overrides:
- getMinimumSize in class Component
minimumSize
public Dimension minimumSize()
- Note: minimumSize() is deprecated.
As of JDK version 1.1,
replaced by getMinimumSize().
- Overrides:
- minimumSize in class Component
addActionListener
public synchronized void addActionListener(ActionListener l)
- Adds the specified action listener to recieve
action events from this textfield.
- Parameters:
- l - the action listener
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
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
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
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