charvax.swing
Class JTextField
JTextField is a component that allows the display and editing of a
single line of text.
The JTextField class, being a subclass of JComponent, has a setBorder()
method which allows an optional Border to be set.
protected Vector | _actionListeners - A list of ActionListeners registered for this component.
|
protected boolean | _bold
|
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 String | _padding - A blank-filled string the same length as the JTextField.
|
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT , _alignmentX , _alignmentY , _background , _cursesColor , _enabled , _focusListeners , _foreground , _keyListeners , _origin , _parent , _visible |
JTextField() - Construct a text field.
|
JTextField(String text_) - Use this constructor when you want to initialize the value.
|
JTextField(String text_, int length_) - Use this constructor when you want to set both the initial value and the
length.
|
JTextField(int length_) - Use this constructor when you want to leave the text field empty
but set its length.
|
addFocusListener , addKeyListener , contains , contains , debug , draw , getAlignmentX , getAlignmentY , getAncestorWindow , getBackground , getBounds , getCursesColor , getForeground , getHeight , getLocation , getLocationOnScreen , getName , getParent , getSize , getWidth , hasFocus , hide , invalidate , isDisplayed , isEnabled , isFocusTraversable , isTotallyObscured , isValid , isVisible , minimumSize , processEvent , processFocusEvent , processKeyEvent , processMouseEvent , repaint , requestFocus , requestSync , setBackground , setEnabled , setForeground , setLocation , setLocation , setName , setParent , setVisible , show , validate , validateCursesColor |
_actionListeners
protected Vector _actionListeners
A list of ActionListeners registered for this component.
_bold
protected boolean _bold
_columns
protected int _columns
_offset
protected int _offset
Index (from the start of the string) of the character displayed
in the left corner of the field. This is always 0 if the string
is shorter than the field.
_padding
protected String _padding
A blank-filled string the same length as the JTextField.
JTextField
public JTextField()
Construct a text field. The initial string is empty and the
number of columns is 10.
JTextField
public JTextField(String text_)
Use this constructor when you want to initialize the value.
JTextField
public JTextField(String text_,
int length_)
Use this constructor when you want to set both the initial value and the
length.
JTextField
public JTextField(int length_)
Use this constructor when you want to leave the text field empty
but set its length.
addActionListener
public void addActionListener(ActionListener al_)
Register an ActionListener object for this component.
draw
public void draw()
Called by this JTextField's parent container.
- draw in interface JComponent
getActionCommand
public String getActionCommand()
Get the action command
getColumns
public int getColumns()
Return the number of columns in the text field.
getSize
public Dimension getSize()
Return the size of the text field. Overrides the method in the
Component superclass.
- getSize in interface Component
postActionEvent
public void postActionEvent(ActionEvent ae_)
Invoke all the ActionListener callbacks that may have been registered
for this component.
processMouseEvent
public void processMouseEvent(MouseEvent e_)
Process a MouseEvent that was generated by clicking the mouse
somewhere inside this JTextField.
Clicking the mouse inside the JTextField moves the caret position
to where the mouse was clicked.
- processMouseEvent in interface Component
setActionCommand
public void setActionCommand(String cmd_)
Set the action command
setColumns
public void setColumns(int columns_)
Sets the number of columns in this Textfield, and then invalidates
the layout.
setEditable
public void setEditable(boolean editable_)
Sets whether this textfield can be edited.
- setEditable in interface JTextComponent
setFont
public void setFont(Font font_)
setText
public void setText(String text_)
Set the text that is presented by this JTextField.
This method is thread-safe, although most Charva methods are not.
- setText in interface JTextComponent
toString
public String toString()
Returns a String representation of this component.