private void wordPrev(JTextArea jta) {
  // виділити попереднє слово
    String s = " ";
    String data = jta.getText().replaceAll("\\p{Punct}", " ")
                               .replaceAll("\\p{Space}", " ");
    while (" ".equals(s) | "".equals(s)) {
      int currentIndex = jta.getCaretPosition();

      currentIndex = (currentIndex > 1) ? currentIndex-1 : 0;
      int endIndex = data.lastIndexOf(" ", currentIndex);
      endIndex = (endIndex > 1) ? endIndex-1 : 0;
      int startIndex = data.lastIndexOf(" ", endIndex);
      endIndex = (endIndex > startIndex) ? endIndex+1 : endIndex;

      startIndex = (startIndex == -1) ? 0 : startIndex+1; // +1 to compensate for the space, no need to highlight that

      jta.setSelectionStart(startIndex);
      jta.setSelectionEnd(endIndex);
      s = data.substring(startIndex, endIndex+1);
    }

  }