Java Utililty Methods JTextComponent Word

List of utility methods to do JTextComponent Word

Description

The list of methods to do JTextComponent Word are organized into topic(s).

Method

DimensiongetWordWrappedTextDimension(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);
voidreplaceWordAtCaretNice(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
...
intsearchInTxComp(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();
...
voidselectWordAtCaret(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 {
...