All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.bwt.JCTextField

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----jclass.bwt.JCComponent
                           |
                           +----jclass.bwt.JCTextComponent
                                   |
                                   +----jclass.bwt.JCTextField

public class JCTextField
extends JCTextComponent
JCTextField is a component that allows the editing of a single line of text.

Properties

Name Method
Alignment setAlignment
Background setBackground
CaretPosition setCaretPosition
Changed setChanged
Columns setColumns
CursorPosition setCursorPosition
DoubleBuffer setDoubleBuffer
EchoChar setEchoChar
Editable setEditable
Font setFont
Foreground setForeground
HighlightColor setHighlightColor
HighlightThickness setHighlightThickness
Insets setInsets
MaximumLength setMaximumLength
Overstrike setOverstrike
PreferredSize setPreferredSize
SelectedBackground setSelectedBackground
SelectedForeground setSelectedForeground
SelectionEnd setSelectionEnd
SelectionList setSelectionList
SelectionStart setSelectionStart
ShadowThickness setShadowThickness
ShowCursorPosition setShowCursorPosition
StringCase setStringCase
Text setText
Traversable setTraversable
UserData setUserData

Events

Class Listener Description
JCActionEvent addActionListener Posted when the ENTER key is hit
JCTextCursorEvent addTextCursorListener Posted when the cursor is moved
JCTextEvent addTextListener Posted when the value changes


Variable Index

 o actionListeners
List of JCActionEvent listeners.

Constructor Index

 o JCTextField()
Creates an empty, editable field with 20 columns.
 o JCTextField(String)
Creates an editable field with the specified text and 20 columns.
 o JCTextField(String, Applet, String)
Creates a text field which reads parameters from the applet's HTML file.
 o JCTextField(String, int)
Creates an editable field with the specified text and number of columns.

Method Index

 o addActionListener(JCActionListener)
Adds the specified action listener to receive action events.
 o echoCharIsSet()
Returns true if a character has been set for echoing.
 o getActionCommand()
Returns the command name of the action event fired by this field.
 o getEchoChar()
Returns the character to be used for echoing, or 0 if no char has been set.
 o getEchoCharString()
Returns a string whose first char is set to the char to be used for echoing, or null if no echo char has been set.
 o getMinimumSize(int)
Returns the minimum size needed for the specified number of columns.
 o getOutputText()
Gets the text which will be displayed.
 o getParameters()
Reads the parameter values from the HTML page using the component's applet.
 o keyDown(Event, int)
Processes keyDown events.
 o paintComponent(Graphics)
Paints the text.
 o pointToPosition(int, int)
Converts an x coordinate into a text position.
 o positionToX(int)
Gets the x co-ordinate for a character position, ignoring scrolling.
 o postActionEvent(Event)
Posts an JCActionEvent.
 o removeActionListener(JCActionListener)
Removes the specified action listener so it no longer receives action events.
 o setActionCommand(String)
Sets the command name of the action event fired by this field.
 o setEchoChar(char)
Sets the echo character.
 o setEchoCharString(String)
Sets the echo character.
 o showPosition(int)
Scrolls the text if necessary to ensure that the position is visible.

Variables

 o actionListeners
 protected JCVector actionListeners
List of JCActionEvent listeners.

Constructors

 o JCTextField
 public JCTextField()
Creates an empty, editable field with 20 columns.

 o JCTextField
 public JCTextField(String text)
Creates an editable field with the specified text and 20 columns.

 o JCTextField
 public JCTextField(String text,
                    int cols)
Creates an editable field with the specified text and number of columns.

 o JCTextField
 public JCTextField(String text,
                    Applet applet,
                    String name)
Creates a text field which reads parameters from the applet's HTML file.

Parameters:
applet - the applet whose PARAM tags are to be read
name - if this is not null, only parameters preceded by this name are read
See Also:
getParameter, JCString

Methods

 o getParameters
 protected void getParameters()
Reads the parameter values from the HTML page using the component's applet. The values will override those previously set.

Overrides:
getParameters in class JCTextComponent
 o getEchoChar
 public char getEchoChar()
Returns the character to be used for echoing, or 0 if no char has been set.

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

Parameters:
c - the echo character, or 0 if the echo char is not to be set
 o getEchoCharString
 public String getEchoCharString()
Returns a string whose first char is set to the char to be used for echoing, or null if no echo char has been set.

See Also:
setEchoChar
 o setEchoCharString
 public void setEchoCharString(String s)
Sets the echo character.

Parameters:
s - the echo string (only the first character is used), or null if the echo char is not to be set
 o echoCharIsSet
 public boolean echoCharIsSet()
Returns true if a character has been set for echoing.

See Also:
setEchoChar, getEchoChar
 o getOutputText
 protected String getOutputText()
Gets the text which will be displayed.

See Also:
setEchoChar
 o positionToX
 public int positionToX(int pos)
Gets the x co-ordinate for a character position, ignoring scrolling.

Overrides:
positionToX in class JCTextComponent
 o showPosition
 public void showPosition(int pos)
Scrolls the text if necessary to ensure that the position is visible.

Parameters:
pos - the number of characters from the beginning of the text buffer.
Overrides:
showPosition in class JCTextComponent
 o setActionCommand
 public void setActionCommand(String command)
Sets the command name of the action event fired by this field. By default this will be a 0-length string.

 o getActionCommand
 public String getActionCommand()
Returns the command name of the action event fired by this field.

See Also:
setActionCommand
 o addActionListener
 public void addActionListener(JCActionListener l)
Adds the specified action listener to receive action events.

See Also:
JCActionEvent
 o removeActionListener
 public void removeActionListener(JCActionListener l)
Removes the specified action listener so it no longer receives action events.

See Also:
addActionListener
 o getMinimumSize
 public Dimension getMinimumSize(int columns)
Returns the minimum size needed for the specified number of columns.

Overrides:
getMinimumSize in class JCTextComponent
 o paintComponent
 protected void paintComponent(Graphics gc)
Paints the text.

Overrides:
paintComponent in class JCComponent
 o pointToPosition
 public int pointToPosition(int x,
                            int y)
Converts an x coordinate into a text position. The y value is ignored.

Overrides:
pointToPosition in class JCTextComponent
 o postActionEvent
 protected void postActionEvent(Event ev)
Posts an JCActionEvent.

See Also:
addActionListener, JCActionEvent
 o keyDown
 public boolean keyDown(Event ev,
                        int key)
Processes keyDown events.
CTRL/A		scrollHome
CTRL/D		deleteCurrentChar
CTRL/E		scrollEnd
CTRL/O		toggleOverstrike
CTRL/C      copyToClipboard
CTRL/X      cutToClipboard
CTRL/V      pasteFromClipboard
HOME        scrollHome
END         scrollEnd
RIGHT		moveForwardChar
LEFT		moveBackwardChar
BS			deletePreviousChar
DELETE		deleteCurrentChar
ENTER		postActionEvent
any other	insertChar

Overrides:
keyDown in class JCTextComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index