why does this code execute multiple time when I start dragging the text. shouldn't it wait until I release the mouse key and then get the selected text? another problem is that it executes first time with "query=null" and then gets the text .
public class linkListener implements MouseMotionListener{ public void mouseDragged(MouseEvent arg0) { //Handle text selection action. query = note.getSelectedText(); System.out.println(query); try { displayItems(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }