else if (this.getLength() == 0) super.insertString(0, "0", new SimpleAttributeSet());
    public void insertString(int offs, String str, AttributeSet a)        throws BadLocationException    {        super.insertString(offs, str.replaceAll("[^\\d]+", ""), a);        //remove leading zeros        while (this.getLength() > 1 && this.getText(0, 1).equals("0"))            remove(0, 1);    }