FileDocCategorySizeDatePackage
SizedTextField.javaAPI DocExample1705Mon Mar 24 02:04:36 GMT 1997None

SizedTextField

public class SizedTextField extends TextField

Fields Summary
private int
size
Constructors Summary
public SizedTextField()

        super ("");
        this.size = 0;
    
public SizedTextField(int columns)

        super (columns);
        this.size = 0;
    
public SizedTextField(int columns, int size)

        super (columns);
        this.size = Math.max (0, size);
    
public SizedTextField(String text)

        super (text);
        this.size = 0;
    
public SizedTextField(String text, int columns)

        super (text, columns);
        this.size = 0;
    
public SizedTextField(String text, int columns, int size)

        super (text, columns);
        this.size = Math.max (0, size);
    
Methods Summary
public booleankeyDown(java.awt.Event e, int key)

        if ((e.id == Event.KEY_PRESS) && (this.size > 0) &&
            (((TextField)(e.target)).getText ().length () >= this.size)) {
            // Check for backspace / delete / tab -- let these pass through
            if ((key == 127) || (key == 8) || (key == 9)) {
                return false;
            }
            return true;
        }
        return false;
    
protected java.lang.StringparamString()

        String str = super.paramString ();
        if (size != 0) {
            str += ",size=" + size;
        }
        return str;