java.awt
Class TextField

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.TextComponent
              |
              +--java.awt.TextField
All Implemented Interfaces:
java.awt.image.ImageObserver

public class TextField
extends TextComponent

TextField is a component that allows the editing of a single line of text.


Field Summary
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TextField()
          Constructs a new TextField.
TextField(int cols)
          Constructs a new TextField initialized with the specified columns.
TextField(String text)
          Constructs a new TextField initialized with the specified text.
TextField(String text, int cols)
          Constructs a new TextField initialized with the specified text and columns.
 
Method Summary
 void addNotify()
          Creates the TextField's peer.
 boolean echoCharIsSet()
          Returns true if this TextField has a character set for echoing.
 int getColumns()
          Returns the number of columns in this TextField.
 char getEchoChar()
          Returns the character to be used for echoing.
 Dimension minimumSize()
          Returns the minimum size Dimensions needed for this TextField.
 Dimension minimumSize(int cols)
          Returns the minimum size Dimensions needed for this TextField with the specified amount of columns.
protected  String paramString()
          Returns the String of parameters for this TExtField.
 Dimension preferredSize()
          Returns the preferred size Dimensions needed for this TextField.
 Dimension preferredSize(int cols)
          Returns the preferred size Dimensions needed for this TextField with the specified amount of columns.
 void setEchoCharacter(char c)
          Sets the echo character for this TextField.
 
Methods inherited from class java.awt.TextComponent
getSelectedText, getSelectionEnd, getSelectionStart, getText, isEditable, removeNotify, select, selectAll, setEditable, setText
 
Methods inherited from class java.awt.Component
action, bounds, checkImage, checkImage, createImage, createImage, deliverEvent, disable, enable, enable, getBackground, getColorModel, getFont, getFontMetrics, getForeground, getGraphics, getParent, getPeer, getToolkit, gotFocus, handleEvent, hide, imageUpdate, inside, invalidate, isEnabled, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setFont, setForeground, show, show, size, toString, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextField

public TextField()
Constructs a new TextField.


TextField

public TextField(int cols)
Constructs a new TextField initialized with the specified columns.

Parameters:
cols - the number of columns

TextField

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

Parameters:
text - the text to be displayed

TextField

public TextField(String text,
                 int cols)
Constructs a new TextField initialized with the specified text and columns.

Parameters:
text - the text to be displayed
cols - the number of columns
Method Detail

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
See Also:
Component.getPeer(), Component.removeNotify()

getEchoChar

public char getEchoChar()
Returns the character to be used for echoing.

See Also:
setEchoCharacter(char), echoCharIsSet()

echoCharIsSet

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

See Also:
setEchoCharacter(char), getEchoChar()

getColumns

public int getColumns()
Returns the number of columns in this TextField.


setEchoCharacter

public void setEchoCharacter(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()

preferredSize

public Dimension preferredSize(int cols)
Returns the preferred size Dimensions needed for this TextField with the specified amount of columns.

Parameters:
cols - the number of columns in this TextField

preferredSize

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

Overrides:
preferredSize in class Component
See Also:
Component.minimumSize(), LayoutManager

minimumSize

public Dimension minimumSize(int cols)
Returns the minimum size Dimensions needed for this TextField with the specified amount of columns.

Parameters:
cols - the number of columns in this TextField

minimumSize

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

Overrides:
minimumSize in class Component
See Also:
Component.preferredSize(), LayoutManager

paramString

protected String paramString()
Returns the String of parameters for this TExtField.

Overrides:
paramString in class TextComponent