@Override
        public void insertString( int offs, String str, AttributeSet a )
                throws BadLocationException {

            if ( str == null ) {
                return;
            }

            char[] chars = str.toCharArray();
            boolean ok = true;

            for ( int i = 0; i < chars.length; i++ ) {
                try {
                    Double.parseDouble(String.valueOf(chars[i]));
                } catch ( NumberFormatException exc ) {
                    if ( chars[i] != '.' ) {
                        ok = false;
                        break;
                    }
                }
            }

            if ( ok )
                super.insertString( offs, new String( chars ), a );
        }