Class TextUtilities
- java.lang.Object
-
- net.sf.gridarta.textedit.textarea.TextUtilities
-
public class TextUtilities extends java.lang.ObjectClass with several utility functions used by the text area component.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intfindMatchingBracket(javax.swing.text.Document doc, int offset)Returns the offset of the bracket matching the one at the specified offset of the document, or -1 if the bracket is unmatched (or if the character is not a bracket).static intfindWordEnd(java.lang.CharSequence line, int pos, java.lang.String noWordSep)Locates the end of the word at the specified position.static intfindWordStart(java.lang.CharSequence line, int pos, java.lang.String noWordSep)Locates the start of the word at the specified position.
-
-
-
Method Detail
-
findMatchingBracket
public static int findMatchingBracket(javax.swing.text.Document doc, int offset) throws javax.swing.text.BadLocationExceptionReturns the offset of the bracket matching the one at the specified offset of the document, or -1 if the bracket is unmatched (or if the character is not a bracket).- Parameters:
doc- the documentoffset- the offset- Returns:
- the offset or
-1 - Throws:
javax.swing.text.BadLocationException- if an out-of-bounds access was attempted on the document text
-
findWordStart
public static int findWordStart(java.lang.CharSequence line, int pos, java.lang.String noWordSep)Locates the start of the word at the specified position.- Parameters:
line- the textpos- the positionnoWordSep- characters that are not part of a word; may benull- Returns:
- the start position of the word
-
findWordEnd
public static int findWordEnd(java.lang.CharSequence line, int pos, java.lang.String noWordSep)Locates the end of the word at the specified position.- Parameters:
line- the textpos- the positionnoWordSep- characters that are not part of a word; may benull- Returns:
- the end position of the word
-
-