t.select(Utilities.getRowStart(t, newDot), Utilities.getRowEnd(t, newDot));
{ setDot(Utilities.getRowStart(t, newDot)); moveDot( Utilities.getRowEnd(t, newDot)); }
  public void mouseClicked(MouseEvent event)  {    int count = event.getClickCount();        if (count >= 2)      {        int newDot = getComponent().viewToModel(event.getPoint());        JTextComponent t = getComponent();        try          {            if (count == 3)              t.select(Utilities.getRowStart(t, newDot), Utilities.getRowEnd(t, newDot));            else              {                int nextWord = Utilities.getNextWord(t, newDot);                                // When the mouse points at the offset of the first character                // in a word Utilities().getPreviousWord will not return that                // word but we want to select that. We have to use                // Utilities.nextWord() to get it.                if (newDot == nextWord)                  t.select(nextWord, Utilities.getNextWord(t, nextWord));                else                  {                    int previousWord = Utilities.getPreviousWord(t, newDot);                    int previousWordEnd = Utilities.getWordEnd(t, previousWord);                                        // If the user clicked in the space between two words,                    // then select the space.                    if (newDot >= previousWordEnd && newDot <= nextWord)                      t.select(previousWordEnd, nextWord);                    // Otherwise select the word under the mouse pointer.                    else                      t.select(previousWord, previousWordEnd);                  }              }          }        catch(BadLocationException ble)          {            // TODO: Swallowing ok here?          }                dot = newDot;      }      }