charva.awt.util

Class ConstrainedTextField


public class ConstrainedTextField
extends CapsTextField

The ConstrainedTextField is a subclass of CapsTextField that limits the length of the text.

Field Summary

Fields inherited from class charvax.swing.JTextField

_actionListeners, _bold, _columns, _offset, _padding

Fields inherited from class charvax.swing.text.JTextComponent

_caretPosition, _document, _editable

Fields inherited from class charvax.swing.JComponent

_border

Fields inherited from class charva.awt.Component

BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT, _alignmentX, _alignmentY, _background, _cursesColor, _enabled, _focusListeners, _foreground, _keyListeners, _origin, _parent, _visible

Constructor Summary

ConstrainedTextField(String text_, int length_)
Use this constructor when you want to set both the initial value and the length.
ConstrainedTextField(int length_)
Use this constructor when you want to leave the text field empty but set its length.

Method Summary

void
processKeyEvent(KeyEvent ke_)
Check the length of the text before calling the superclass' processKeyEvent() method.

Methods inherited from class charva.awt.util.CapsTextField

processKeyEvent

Methods inherited from class charvax.swing.JTextField

addActionListener, debug, draw, getActionCommand, getColumns, getHeight, getSize, getWidth, isEditable, minimumSize, postActionEvent, processEvent, processKeyEvent, processMouseEvent, requestFocus, setActionCommand, setBounds, setBounds, setBounds, setColumns, setEditable, setFont, setText, toString

Methods inherited from class charvax.swing.text.JTextComponent

getCaretPosition, getDocument, getText, isEditable, setCaretPosition, setDocument, setEditable, setText

Methods inherited from class charvax.swing.JComponent

draw, getBorder, getInsets, setBorder

Methods inherited from class charva.awt.Component

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, setBounds, setBounds, setBounds, setEnabled, setForeground, setLocation, setLocation, setName, setParent, setVisible, show, validate, validateCursesColor

Constructor Details

ConstrainedTextField

public ConstrainedTextField(String text_,
                            int length_)
Use this constructor when you want to set both the initial value and the length.

ConstrainedTextField

public ConstrainedTextField(int length_)
Use this constructor when you want to leave the text field empty but set its length.

Method Details

processKeyEvent

public void processKeyEvent(KeyEvent ke_)
Check the length of the text before calling the superclass' processKeyEvent() method. If the text is already maximum length and it is a printing character, ring the bell.
Overrides:
processKeyEvent in interface CapsTextField