public class JTextField extends JTextComponent
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Vector |
_actionListeners
A list of ActionListeners registered for this component.
|
protected int |
_columns |
protected int |
_offset
Index (from the start of the string) of the character displayed
in the left corner of the field.
|
protected java.lang.String |
_padding
A blank-filled string the same length as the JTextField.
|
_bold, _caretPosition, _document, _editable_border_alignmentX, _alignmentY, _background, _cursesColor, _enabled, _focusListeners, _foreground, _keyListeners, _origin, _parent, _visible, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Constructor and Description |
|---|
JTextField()
Construct a text field.
|
JTextField(int length_)
Use this constructor when you want to leave the text field empty
but set its length.
|
JTextField(java.lang.String text_)
Use this constructor when you want to initialize the value.
|
JTextField(java.lang.String text_,
int length_)
Use this constructor when you want to set both the initial value and the
length.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addActionListener(ActionListener al_)
Register an ActionListener object for this component.
|
void |
debug(int level_) |
void |
draw()
Called by this JTextField's parent container.
|
java.lang.String |
getActionCommand()
Get the action command
|
int |
getColumns()
Return the number of columns in the text field.
|
int |
getHeight() |
Dimension |
getSize()
Return the size of the text field.
|
int |
getWidth() |
boolean |
isEditable()
Returns the boolean flag indicating whether this TextComponent
is editable or not.
|
Dimension |
minimumSize()
Called by the LayoutManager.
|
void |
postActionEvent(ActionEvent ae_)
Invoke all the ActionListener callbacks that may have been registered
for this component.
|
protected void |
processEvent(AWTEvent evt_)
Process events.
|
void |
processKeyEvent(KeyEvent ke_)
Process KeyEvents that have been generated by this JTextField.
|
void |
processMouseEvent(MouseEvent e_)
Process a MouseEvent that was generated by clicking the mouse
somewhere inside this JTextField.
|
void |
requestFocus()
This method should be invoked by all subclasses of Component
which override this method; because this method generates the
FOCUS_GAINED event when the component gains the keyboard focus.
|
void |
setActionCommand(java.lang.String cmd_)
Set the action command
|
void |
setBounds(int top_,
int left_,
int bottom_,
int right_) |
void |
setBounds(Point topleft_,
Dimension size_) |
void |
setBounds(Rectangle bounds) |
void |
setColumns(int columns_)
Sets the number of columns in this Textfield, and then invalidates
the layout.
|
void |
setEditable(boolean editable_)
Sets whether this textfield can be edited.
|
void |
setText(java.lang.String text_)
Set the text that is presented by this JTextField.
|
java.lang.String |
toString()
Returns a String representation of this component.
|
getCaretPosition, getDocument, getText, setCaretPosition, setDocument, setFontgetBorder, getInsets, setBorderaddFocusListener, addKeyListener, contains, contains, getAlignmentX, getAlignmentY, getAncestorWindow, getBackground, getBounds, getCursesColor, getForeground, getLocation, getLocationOnScreen, getName, getParent, hasFocus, hide, invalidate, isDisplayed, isEnabled, isFocusTraversable, isRecursivelyVisible, isTotallyObscured, isValid, isVisible, processFocusEvent, repaint, requestSync, setBackground, setEnabled, setForeground, setLocation, setLocation, setName, setParent, setVisible, show, validate, validateCursesColorprotected int _columns
protected int _offset
protected java.lang.String _padding
protected java.util.Vector _actionListeners
public JTextField()
public JTextField(java.lang.String text_)
public JTextField(int length_)
public JTextField(java.lang.String text_,
int length_)
public void setColumns(int columns_)
public void setBounds(int top_,
int left_,
int bottom_,
int right_)
public int getColumns()
public void setActionCommand(java.lang.String cmd_)
public java.lang.String getActionCommand()
public Dimension getSize()
public Dimension minimumSize()
minimumSize in class Componentpublic void setEditable(boolean editable_)
setEditable in class JTextComponentpublic boolean isEditable()
JTextComponentisEditable in class JTextComponentpublic void draw()
draw in class JComponentpublic void processKeyEvent(KeyEvent ke_)
processKeyEvent in class Componentpublic void processMouseEvent(MouseEvent e_)
processMouseEvent in class Componentpublic void setText(java.lang.String text_)
setText in class JTextComponentprotected void processEvent(AWTEvent evt_)
processEvent in class Componentpublic void postActionEvent(ActionEvent ae_)
public void addActionListener(ActionListener al_)
public void requestFocus()
ComponentrequestFocus in class Componentpublic java.lang.String toString()
toString in class java.lang.Object