java.awt
Class TextField
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.TextComponent
|
+--java.awt.TextField
This class implements a single line text entry field widget
Author:- Aaron M. Renn (arenn@urbanophile.com)
TextField
public TextField()
Initializes a new instance of TextField
that is empty
and has one column.
Throws:
TextField
public TextField(int columns)
Initializes a new instance of TextField
that is empty
and has the specified number of columns.
Parameters:
Throws:
TextField
public TextField(java.lang.String text)
Initializes a new instance of TextField
containing
the specified text. The number of columns will be equal to the
length of the text string.
Parameters:
Throws:
TextField
public TextField(java.lang.String text, int columns)
Initializes a new instance of TextField
with the
specified text and number of columns.
Parameters:
Throws:
addActionListener
public synchronized void addActionListener(java.awt.event.ActionListener listener)
Addes a new listener to the list of action listeners for this
object.
Parameters:
addNotify
public void addNotify()
Notifies this object that it should create its native peer.
echoCharIsSet
public 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.
Returns:
true
if an echo character is set,
false
otherwise.
getActionListeners
public ActionListener[] getActionListeners()
Return all ActionListeners register to this TextField
object
as an array.
Since:
getColumns
public int getColumns()
Returns the number of columns in the field.
Returns:
- The number of columns in the field.
getEchoChar
public 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).
Returns:
- The echo character for this text field.
getListeners
public EventListener[] getListeners(java.lang.Class listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this TextField
. FooListeners are registered using the
addFooListener method.
Since:Parameters:
Throws:
ClassCastException
- If listenerType doesn't specify a class or
interface that implements java.util.EventListener.
getMinimumSize
public Dimension getMinimumSize()
Returns the minimum size for this text field.
Returns:
- The minimum size for this text field.
getMinimumSize
public Dimension getMinimumSize(int columns)
Returns the minimum size of a text field with the specified number
of columns.
Parameters:
getPreferredSize
public Dimension getPreferredSize()
Returns the preferred size for this text field.
Returns:
- The preferred size for this text field.
getPreferredSize
public Dimension getPreferredSize(int columns)
Returns the preferred size of a text field with the specified number
of columns.
Parameters:
minimumSize
public Dimension minimumSize()
Returns the minimum size for this text field.
Returns:
- The minimum size for this text field.
minimumSize
public Dimension minimumSize(int columns)
Returns the minimum size of a text field with the specified number
of columns.
Parameters:
paramString
protected String paramString()
Returns a debug string for this object.
Returns:
- A debug string for this object.
preferredSize
public Dimension preferredSize()
Returns the preferred size for this text field.
Returns:
- The preferred size for this text field.
preferredSize
public Dimension preferredSize(int columns)
Returns the preferred size of a text field with the specified number
of columns.
Parameters:
processActionEvent
protected void processActionEvent(java.awt.event.ActionEvent event)
Processes an action event by calling any registered listeners.
Note to subclasses: This method is not called unless action events
are enabled on this object. This will be true if any listeners
are registered, or if action events were specifically enabled
using enableEvents()
.
Parameters:
processEvent
protected void processEvent(java.awt.AWTEvent event)
Processes the specified event. If the event is an instance of
ActionEvent
then processActionEvent()
is
called to process it, otherwise the event is sent to the
superclass.
Parameters:
removeActionListener
public synchronized void removeActionListener(java.awt.event.ActionListener listener)
Removes the specified listener from the list of action listeners
for this object.
Parameters:
setColumns
public synchronized void setColumns(int columns)
Sets the number of columns in this field to the specified value.
Parameters:
Throws:
setEchoChar
public void setEchoChar(char echoChar)
Sets the character that is echoed when protected input such as
a password is displayed.
Parameters:
setEchoCharacter
public void setEchoCharacter(char echoChar)
Sets the character that is echoed when protected input such as
a password is displayed.
Parameters: