    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

##

actionListeners
  List of JCActionEvent listeners.

##

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

##

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

##

actionListeners

     protected JCVector actionListeners

  List of JCActionEvent listeners.

##

JCTextField

     public JCTextField()

  Creates an empty, editable field with 20 columns.

JCTextField

     public JCTextField(String text)

  Creates an editable field with the specified text and 20 columns.

JCTextField

     public JCTextField(String text,
                        int cols)

  Creates an editable field with the specified text and number of columns.

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

##

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

getEchoChar

     public char getEchoChar()

  Returns the character to be used for echoing, or 0 if no char has been set.

  See Also:
    setEchoChar

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

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

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

echoCharIsSet

     public boolean echoCharIsSet()

  Returns true if a character has been set for echoing.

  See Also:
    setEchoChar, getEchoChar

getOutputText

     protected String getOutputText()

  Gets the text which will be displayed.

  See Also:
    setEchoChar

positionToX

     public int positionToX(int pos)

  Gets the x co-ordinate for a character position, ignoring scrolling.

  Overrides:
    positionToX in class JCTextComponent

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

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.

getActionCommand

     public String getActionCommand()

  Returns the command name of the action event fired by this field.

  See Also:
    setActionCommand

addActionListener

     public void addActionListener(JCActionListener l)

  Adds the specified action listener to receive action events.

  See Also:
    JCActionEvent

removeActionListener

     public void removeActionListener(JCActionListener l)

  Removes the specified action listener so it no longer receives action events.

  See Also:
    addActionListener

getMinimumSize

     public Dimension getMinimumSize(int columns)

  Returns the minimum size needed for the specified number of columns.

  Overrides:
    getMinimumSize in class JCTextComponent

paintComponent

     protected void paintComponent(Graphics gc)

  Paints the text.

  Overrides:
    paintComponent in class JCComponent

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

postActionEvent

     protected void postActionEvent(Event ev)

  Posts an JCActionEvent.

  See Also:
    addActionListener, JCActionEvent

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