public void insertString(int offs, String str, AttributeSet a)  
            throws BadLocationException  
        {  
            StringBuffer buffer = new StringBuffer( getText( 0, getLength() ) );  
			if ( ( buffer.length() + str.length() ) <= maximum )  
			{  
			super.insertString(offs, str, a);  
			}  
			else  
			{  
			Toolkit.getDefaultToolkit().beep();  
			}  
        }