List of utility methods to do JTextComponent Word
Dimension | getWordWrappedTextDimension(JTextComponent textComponent, int width) Returns the Dimension for the given JTextComponent subclass that will show the whole word wrapped text in the given width. return getWordWrappedTextDimension(textComponent, width, null);
|
void | replaceWordAtCaretNice(JTextComponent editor, String strText) replace Word At Caret Nice String strWordAtCaret = getWordAtCaret(editor); if (strWordAtCaret != null && strWordAtCaret.length() > 0 && Character.isLetterOrDigit(strWordAtCaret.charAt(0))) { replaceWordAtCaret(editor, strText); return; String strWordBeforeCaret = getPartialWordBeforeCaret(editor); if (strWordBeforeCaret != null && strWordBeforeCaret.length() > 0 ... |
int | searchInTxComp(JTextComponent src, String word) Returns offset of the given word in src the component int firstOffset = -1; if (word == null || word.isEmpty()) { return -1; String content = null; try { Document d = src.getDocument(); content = d.getText(0, d.getLength()).toLowerCase(); ... |
void | selectWordAtCaret(JTextComponent editor) select Word At Caret int iStart = 0; int iEnd = 0; try { int iCaretPos = editor.getCaretPosition(); iStart = getWordStart(editor, iCaretPos); iEnd = getWordEnd(editor, iCaretPos); } catch (BadLocationException e) { try { ... |