ERROR - BadLocationException - Possible Causes of BadLocationException

Exception Thrown By:Cause
ClassMethod
AbstractDocument public Position createPosition(int offs)if the given position does not represent a valid location in the associated document
GapContent public Position createPosition(int offset)if the specified position is invalidshift
JTextArea public int getLineOfOffset(int offset)thrown if the offset is less than zero or greater than the document length.get
JTextArea public int getLineStartOffset(int line)thrown if the line is less than zero or greater or equal to the number of lines contained in the document (as reported by get
JTextArea public int getLineEndOffset(int line)Thrown if the line is less than zero or greater or equal to the number of lines contained in the document (as reported by get
JTextComponent public Rectangle modelToView(int pos)if the given position does not represent a valid location in the associated document
StringContent public Position createPosition(int offset)if the specified position is invalidget