Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Generated Object

A javax.swing.JTextField is returned, unless the user passes in a subclass of JTextField as the value argument, in which case the value argument is returned.

Value Argument

The value argument can be either a JTextField, or a String. If the value argument is a string it is treated as though it were passed in as the text attribute.

Attributes

Declared in JTextField

  • action <Action> the Action instance connected with this ActionEvent source
  • columns <int> the number of columns preferred for display
  • horizontalAlignment <int> Set the field alignment to LEFT, CENTER, RIGHT, LEADING (the default) or TRAILING
  • scrollOffset <int> scrollOffset

Declared in javax.swing.text.JTextComponent

  • caret <javax.swing.text.Caret> the caret used to select/navigate
  • caretColor <Color> the color used to render the caret
  • caretPosition <int> the caret position
  • disabledTextColor <Color> color used to render disabled text
  • document <javax.swing.text.Document> the text document model
  • editable <boolean> specifies if the text can be edited
  • focusAccelerator <char> accelerator character used to grab focus
  • highlighter <javax.swing.text.Highlighter> object responsible for background highlights
  • margin <Insets> desired space between the border and text area
  • selectedText <String> selectedText
  • selectedTextColor <Color> color used to render selected text
  • selectionColor <Color> color used to render selection background
  • selectionEnd <int> ending location of the selection.
  • selectionStart <int> starting location of the selection.
  • text <String> the text of this component

Content

No child content is accepted in a textField.

Usage

The action connected to the textField is usually fired when the 'Enter' key is pressed by the user when the textField has keyboard focus.

Examples

//TODO

Observable Attributes

  • text - via syntetic observation
  • caret
  • caretColor
  • disabledTextColor
  • document
  • dragEnabled
  • editable
  • focusAccelerator
  • highlighter
  • keymap
  • margin
  • selectedTextColor
  • selectionColor