javax.swing
public class JTextField extends JTextComponent implements SwingConstants
| Nested Class Summary | |
|---|---|
| protected class | JTextField.AccessibleJTextField 
 AccessibleJTextField  | 
| Field Summary | |
|---|---|
| static String | notifyAction 
 Name of the action that gets sent when the content of the text field
 gets accepted.  | 
| Constructor Summary | |
|---|---|
| JTextField() 
 Creates a new instance of  JTextField. | |
| JTextField(String text) 
 Creates a new instance of  JTextField.
 | |
| JTextField(int columns) 
 Creates a new instance of  JTextField.
 | |
| JTextField(String text, int columns) 
 Creates a new instance of  JTextField.
 | |
| JTextField(Document doc, String text, int columns) 
 Creates a new instance of  JTextField.
 | |
| Method Summary | |
|---|---|
| void | addActionListener(ActionListener listener) 
 Adds a new listener object to this text field.
  | 
| protected void | configurePropertiesFromAction(Action action) | 
| protected PropertyChangeListener | createActionPropertyChangeListener(Action action) | 
| protected Document | createDefaultModel() 
 Creates the default model for this text field.
   | 
| protected void | fireActionPerformed() 
 Sends an action event to all registered
  ActionListener objects. | 
| AccessibleContext | getAccessibleContext() 
 Returns the accessible context associated with the  JTextField.
 | 
| Action | getAction() | 
| ActionListener[] | getActionListeners() 
 Returns all registered  ActionListener objects.
 | 
| Action[] | getActions() 
 Returns the set of Actions that are commands for the editor.
   | 
| int | getColumns() 
 Returns the number of columns of this text field.
  | 
| protected int | getColumnWidth() 
 Returns the column width, which is the width of the character m
 for the font in use.  | 
| int | getHorizontalAlignment() 
 Returns the horizontal alignment, which is one of: JTextField.LEFT, 
 JTextField.CENTER, JTextField.RIGHT, JTextField.LEADING, 
 JTextField.TRAILING.  | 
| BoundedRangeModel | getHorizontalVisibility() 
 Returns the bounded range model that describes the horizontal visibility
 of the text field in the case when the text does not fit into the
 available space.   | 
| Dimension | getPreferredSize() 
 Returns the preferred size.    | 
| int | getScrollOffset() 
 Returns the scroll offset in pixels.
  | 
| String | getUIClassID() 
 Returns the class ID for the UI.
  | 
| boolean | isValidateRoot() 
 Returns  true, unless this is embedded in a
 JViewport in which case the viewport takes responsibility of
 validating.
 | 
| void | postActionEvent() | 
| void | removeActionListener(ActionListener listener) 
 Removes a listener object from this text field.
  | 
| void | scrollRectToVisible(Rectangle r) | 
| void | setAction(Action newAction) | 
| void | setActionCommand(String command) 
 Sets the command string used in action events.  | 
| void | setColumns(int columns) 
 Sets the number of columns and then invalidates the layout.  | 
| void | setDocument(Document doc) 
 Sets the document to be used for this JTextField.
   | 
| void | setFont(Font newFont) 
 Sets the current font and revalidates so the font will take effect.  | 
| void | setHorizontalAlignment(int newAlign) 
 Sets the horizontal alignment of the text.    | 
| void | setScrollOffset(int offset) 
 Sets the scroll offset in pixels.
  | 
JTextField.JTextField.
Parameters: text the initial text
JTextField.
Parameters: columns the number of columns
Throws: IllegalArgumentException if columns %lt; 0
JTextField.
Parameters: text the initial text columns the number of columns
Throws: IllegalArgumentException if columns %lt; 0
JTextField.
Parameters: doc the document to use text the initial text columns the number of columns
Throws: IllegalArgumentException if columns %lt; 0
Parameters: listener the listener to add
Since: 1.3
Since: 1.3
PlainDocument.
Returns: a new instance of the default model
ActionListener objects.JTextField.
Returns: the accessible context associated with the JTextField 
Since: 1.3
ActionListener objects.
Returns: an array of listeners
Since: 1.4
Returns: the number of columns
Returns: the width of the character m for the font in use.
Returns: the horizontal alignment
Returns: the bounded range model that describes the horizontal visibility
Returns: the scroll offset
Returns: "TextFieldUI";
true, unless this is embedded in a
 JViewport in which case the viewport takes responsibility of
 validating.
Returns: true, unless this is embedded in a
         JViewport in which case the viewport takes
         responsibility of validating 
Parameters: listener the listener to remove
Since: 1.3
Since: 1.3
Parameters: columns the number of columns
Throws: IllegalArgumentException if columns < 0
filterNewlines to
 true and then calls the super behaviour to setup a view and
 revalidate the text field.
Parameters: doc the document to set
Parameters: newAlign must be one of: JTextField.LEFT, JTextField.CENTER, JTextField.RIGHT, JTextField.LEADING, JTextField.TRAILING.
Throws: IllegalArgumentException if newAlign is not one of the above.
Parameters: offset the scroll offset