- currentWord = new Word(this.defaultColor, this.highlighter);
- words.add(currentWord);
- for (int i = 0; i < str.length(); i++) {
- char ch = str.charAt(i);
- Word newWord = currentWord.addChar(ch);
- if (newWord != currentWord) {
- words.add(newWord);
- currentWord = newWord;
- }
- }
- for (Word word: words) {
- word.applyHighlight();
- }