public void insertString(int offset, String str, AttributeSet set) throws BadLocationException{
        if(str == null){
            return;
        }else if((getLength() + str.length())<= limit){
            super.insertString(offset, str, set);
        }
    }