FileDocCategorySizeDatePackage
NumericField.javaAPI DocExample841Mon May 01 14:42:08 BST 2000magicbeans

NumericField

public class NumericField extends JTextField implements ActionListener

Fields Summary
private double
value
Constructors Summary
public NumericField()

        super(6);
        addActionListener( this );
    
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent e)

        try {
            setValue( Double.parseDouble( getText(  ) ) );
        } catch ( NumberFormatException ex ) {
            select(0, getText().length(  ));
        }
    
public doublegetValue()

        return value;
    
public voidsetValue(double newValue)

        double oldValue = value;
        value = newValue;
        setText( "" + newValue );
        firePropertyChange( "value", oldValue, newValue );