private void jeSourceCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_jeSourceCaretUpdate
  //
  if (jeSource.getSelectionEnd()>jeSource.getSelectionStart()) {
    //
    jtWord.setText(jeSource.getSelectedText());
  } else {
    jtWord.setText("");
  }
  jtWord1.setText(jtWord.getText());
  // знайти переклад слова
  if (!"".equals(jtWord.getText())) {
    try {
      String qry = "select translation from dict where word=? collate nocase order by id";
      PreparedStatement ps;
      ps = conn.prepareStatement(qry);
      ps.setString(1, jtWord.getText().trim().toLowerCase());
      ResultSet rs;
      rs = ps.executeQuery();
      DefaultListModel lm = new DefaultListModel();
      while (rs.next()) {
        lm.addElement(rs.getString(1));
      }
      if (lm.size()>0) {
        jtTranslation.setText(lm.firstElement().toString());
      } else {
        jtTranslation.setText("");
      }
      jlSynonim.setModel(lm);
      jlSynonim.setSelectedIndex(0);
      rs.close();
      ps.close();
    } catch (SQLException ex) {
      Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
}//GEN-LAST:event_jeSourceCaretUpdate