GeezerVison is showing docs.oracle.com — TextField (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
-
-
Nested Class Summary
Nested Classes
| Modifier and Type |
Class |
Description |
protected class |
TextField.AccessibleAWTTextField |
This class implements accessibility support for the
TextField class.
|
-
Constructor Summary
Constructors
| Constructor |
Description |
TextField() |
Constructs a new text field.
|
TextField(int columns) |
Constructs a new empty text field with the specified number
of columns.
|
TextField(String text) |
Constructs a new text field initialized with the specified text.
|
TextField(String text,
int columns) |
Constructs a new text field initialized with the specified text
to be displayed, and wide enough to hold the specified
number of columns.
|
-
Method Summary
-
Methods inherited from class java.awt.TextComponent
addTextListener, enableInputMethods, getBackground, getCaretPosition, getInputMethodRequests, getSelectedText, getSelectionEnd, getSelectionStart, getText, getTextListeners, isEditable, processTextEvent, removeNotify, removeTextListener, select, selectAll, setBackground, setCaretPosition, setEditable, setSelectionEnd, setSelectionStart
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
-
-
Constructor Detail
-
TextField
public TextField(int columns)
throws HeadlessException
Constructs a new empty text field with the specified number
of columns. A column is an approximate average character
width that is platform-dependent.
- Parameters:
columns - the number of columns. If
columns is less than 0,
columns is set to 0.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true.
- See Also:
GraphicsEnvironment.isHeadless()
-
TextField
public TextField(String text,
int columns)
throws HeadlessException
Constructs a new text field initialized with the specified text
to be displayed, and wide enough to hold the specified
number of columns. A column is an approximate average character
width that is platform-dependent.
- Parameters:
text - the text to be displayed. If
text is null, the empty
string "" will be displayed.
columns - the number of columns. If
columns is less than 0,
columns is set to 0.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true.
- See Also:
GraphicsEnvironment.isHeadless()
-
Method Detail
-
setEchoCharacter
@Deprecated
public void setEchoCharacter(char c)
Deprecated. As of JDK version 1.1,
replaced by setEchoChar(char).
-
preferredSize
@Deprecated
public Dimension preferredSize(int columns)
Deprecated. As of JDK version 1.1,
replaced by getPreferredSize(int).
-
minimumSize
@Deprecated
public Dimension minimumSize(int columns)
Deprecated. As of JDK version 1.1,
replaced by getMinimumSize(int).
-
paramString
protected String paramString()
Returns a string representing the state of this TextField.
This method is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not be
null.
- Overrides:
paramString in class TextComponent
- Returns:
- the parameter string of this text field
-
getAccessibleContext
public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this TextField.
For text fields, the AccessibleContext takes the form of an
AccessibleAWTTextField.
A new AccessibleAWTTextField instance is created if necessary.
- Specified by:
getAccessibleContext in interface Accessible
- Overrides:
getAccessibleContext in class TextComponent
- Returns:
- an AccessibleAWTTextField that serves as the
AccessibleContext of this TextField
- Since:
- 1.3
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|