}
    public void actionPerformed(ActionEvent event)    {      JTextComponent t = getTextComponent(event);      Caret c = t.getCaret();      int dot = c.getDot();      try        {          int wordStart = Utilities.getWordStart(t, dot);                if (dot == wordStart)            {              // Current cursor position is on the first character in a word.              c.setDot(wordStart);              c.moveDot(Utilities.getWordEnd(t, wordStart));            }          else            {              // Current cursor position is not on the first character              // in a word.               int nextWord = Utilities.getNextWord(t, dot);              int previousWord = Utilities.getPreviousWord(t, dot);              int previousWordEnd = Utilities.getWordEnd(t, previousWord);              // Cursor position is in the space between two words. In such a              // situation just select the space.              if (dot >= previousWordEnd && dot <= nextWord)                {                  c.setDot(previousWordEnd);                  c.moveDot(nextWord);            }              else                {                  // Cursor position is inside a word. Just select it then.                  c.setDot(previousWord);                  c.moveDot(previousWordEnd);                }            }          // If the position was updated change the magic caret position          // as well.          if (c.getDot() != dot)            c.setMagicCaretPosition(t.modelToView(c.getDot()).getLocation());                  }      catch(BadLocationException ble)         {          // Can't happen.        }    }