Example usage for Java javax.swing JTextField fields, constructors, methods, implement or subclass
The text is from its open source code.
String | notifyAction Name of the action to send notification that the contents of the field have been accepted. |
JTextField(String text) Constructs a new TextField initialized with the specified text. | |
JTextField(int columns) Constructs a new empty TextField with the specified number of columns. | |
JTextField() Constructs a new TextField . | |
JTextField(String text, int columns) Constructs a new TextField initialized with the specified text and columns. | |
JTextField(Document doc, String text, int columns) Constructs a new JTextField that uses the given text storage model and the given number of columns. |
Component | add(Component comp) Appends the specified component to the end of this container. |
void | addActionListener(ActionListener l) Adds the specified action listener to receive action events from this textfield. |
void | addAncestorListener(AncestorListener listener) Registers listener so that it will receive AncestorEvents when it or any of its ancestors move or are made visible or invisible. |
void | addCaretListener(CaretListener listener) Adds a caret listener for notification of any changes to the caret. |
void | addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus. |
void | addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component. |
void | addMouseListener(MouseListener l) Adds the specified mouse listener to receive mouse events from this component. |
void | addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component. |
void | addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list. |
void | copy() Transfers the currently selected range in the associated text model to the system clipboard, leaving the contents in the text model. |
void | cut() Transfers the currently selected range in the associated text model to the system clipboard, removing the contents from the model. |
AccessibleContext | getAccessibleContext() Gets the AccessibleContext associated with this JTextField . |
Action | getAction() Returns the currently set Action for this ActionEvent source, or null if no Action is set. |
ActionListener[] | getActionListeners() Returns an array of all the ActionListener s added to this JTextField with addActionListener(). |
ActionMap | getActionMap() Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding. |
Action[] | getActions() Fetches the command list for the editor. |
Color | getBackground() Gets the background color of this component. |
Border | getBorder() Returns the border of this component or null if no border is currently set. |
int | getCaretPosition() Returns the position of the text insertion caret for the text component. |
Object | getClientProperty(Object key) Returns the value of the property with the specified key. |
Document | getDocument() Fetches the model associated with the editor. |
Font | getFont() Gets the font of this component. |
FontMetrics | getFontMetrics(Font font) Gets the FontMetrics for the specified Font . |
Color | getForeground() Gets the foreground color of this component. |
int | getHeight() Returns the current height of this component. |
int | getHorizontalAlignment() Returns the horizontal alignment of the text. |
BoundedRangeModel | getHorizontalVisibility() Gets the visibility of the text field. |
InputMap | getInputMap(int condition) Returns the InputMap that is used during condition . |
InputMap | getInputMap() Returns the InputMap that is used when the component has focus. |
Keymap | getKeymap() Fetches the keymap currently active in this text component. |
Point | getLocationOnScreen() Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space. |
String | getName() Gets the name of the component. |
Dimension | getPreferredSize() Returns the preferred size Dimensions needed for this TextField . |
int | getScrollOffset() Gets the scroll offset, in pixels. |
String | getSelectedText() Returns the selected text contained in this TextComponent . |
int | getSelectionEnd() Returns the selected text's end position. |
int | getSelectionStart() Returns the selected text's start position. |
String | getText() Returns the text contained in this TextComponent . |
Toolkit | getToolkit() Gets the toolkit of this component. |
String | getToolTipText() Returns the tooltip string that has been set with setToolTipText . |
Container | getTopLevelAncestor() Returns the top-level ancestor of this component (either the containing Window or Applet ), or null if this component has not been added to any container. |
int | getWidth() Returns the current width of this component. |
boolean | hasFocus() Returns true if this Component is the focus owner. |
boolean | isEnabled() Determines whether this component is enabled. |
boolean | isOpaque() Returns true if this component is completely opaque. |
Rectangle | modelToView(int pos) Converts the given location in the model to a place in the view coordinate system. |
void | paste() Transfers the contents of the system clipboard into the associated text model. |
void | read(Reader in, Object desc) Initializes from a stream. |
void | registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition) This method is now obsolete, please use a combination of getActionMap() and getInputMap() for similar behavior. |
void | removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component. |
void | repaint() Repaints this component. |
void | replaceSelection(String content) Replaces the currently selected content with new content represented by the given string. |
void | requestFocus() Requests that this Component gets the input focus. |
boolean | requestFocusInWindow() Requests that this Component gets the input focus. |
void | revalidate() Supports deferred automatic layout. |
void | select(int selectionStart, int selectionEnd) Selects the text between the specified start and end positions. |
void | selectAll() Selects all the text in the TextComponent . |
void | setAction(Action a) Sets the Action for the ActionEvent source. |
void | setActionCommand(String command) Sets the command string used for action events. |
void | setAlignmentX(float alignmentX) Sets the horizontal alignment. |
void | setAutoscrolls(boolean autoscrolls) Sets the autoscrolls property. |
void | setBackground(Color bg) Sets the background color of this component. |
void | setBorder(Border border) Sets the border of this component. |
void | setBounds(int x, int y, int width, int height) Moves and resizes this component. |
void | setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r . |
void | setCaret(Caret c) Sets the caret to be used. |
void | setCaretPosition(int position) Sets the position of the text insertion caret for the TextComponent . |
void | setColumns(int columns) Sets the number of columns in this TextField , and then invalidate the layout. |
void | setComponentPopupMenu(JPopupMenu popup) Sets the JPopupMenu for this JComponent . |
void | setDisabledTextColor(Color c) Sets the current color used to render the disabled text. |
void | setDocument(Document doc) Associates the editor with a text document. |
void | setDragEnabled(boolean b) Turns on or off automatic drag handling. |
void | setEditable(boolean b) Sets the specified boolean to indicate whether or not this TextComponent should be editable. |
void | setEnabled(boolean enabled) Sets whether or not this component is enabled. |
void | setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value. |
void | setFocusAccelerator(char aKey) Sets the key accelerator that will cause the receiving text component to get the focus. |
void | setFont(Font f) Sets the current font. |
void | setForeground(Color fg) Sets the foreground color of this component. |
void | setHorizontalAlignment(int alignment) Sets the horizontal alignment of the text. |
void | setInheritsPopupMenu(boolean value) Sets whether or not getComponentPopupMenu should delegate to the parent if this component does not have a JPopupMenu assigned to it. |
void | setInputVerifier(InputVerifier inputVerifier) Sets the input verifier for this component. |
void | setLayout(LayoutManager mgr) Sets the layout manager for this container. |
void | setLocation(int x, int y) Moves this component to a new location. |
void | setMargin(Insets m) Sets margin space between the text component's border and its text. |
void | setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value. |
void | setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value. |
void | setName(String name) Sets the name of the component to the specified string. |
void | setNavigationFilter(NavigationFilter filter) Sets the NavigationFilter . |
void | setOpaque(boolean isOpaque) If true the component paints every pixel within its bounds. |
void | setPreferredSize(Dimension preferredSize) Sets the preferred size of this component. |
void | setScrollOffset(int scrollOffset) Sets the scroll offset, in pixels. |
void | setSelectionEnd(int selectionEnd) Sets the selection end to the specified position. |
void | setSelectionStart(int selectionStart) Sets the selection start to the specified position. |
void | setSize(int width, int height) Resizes this component so that it has width width and height height . |
void | setSize(Dimension d) Resizes this component so that it has width d.width and height d.height . |
void | setText(String t) Sets the text of this TextComponent to the specified text. |
void | setToolTipText(String text) Registers the text to display in a tool tip. |
void | setTransferHandler(TransferHandler newHandler) Sets the TransferHandler , which provides support for transfer of data into and out of this component via cut/copy/paste and drag and drop. |
void | setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget) Sets the value to indicate whether input verifier for the current focus owner will be called before this component requests focus. |
void | setVisible(boolean aFlag) Makes the component visible or invisible. |
void | transferFocus() Transfers the focus to the next component, as though this Component were the focus owner. |
int | viewToModel(Point pt) Converts the given place in the view coordinate system to the nearest representative location in the model. |
void | write(Writer out) Stores the contents of the model into the given stream. |