ItemClickEvent BUTTON_LEFT prevent user from selecting text in a table row


I have a problem with a ItemClickEvent and don´t know how to solve it.

We have a table. When someone do a left mouse click, the table row is selected (background color change). We have an ItemClickListener which catch the click event, because we have to set in a different tab in a tree a corresponding tree-element.

Before we implement this listener, all works fine: You could select text from the table (to copy it to the clipboard) and the row was selected as well.

Now, because we need to mark the element in the tree, when the table-row is clicked left, text selection does not work anymore.

What the user do:

  • click left with the mouse button
  • hold the button down and swype the mouse to select text
  • after release the left mouse button, the selection disappears
  • the background of the row is selected (and the element in the named tree above is selected, too).

What the user want instead:

  • click left with the mouse button
  • hold the button down and swype the mouse to select text (optional)
  • the row is marked (and the listener marks the tree element as well)
  • the text keep selected (optional)
  • the user can use ctr+c to copy the marked text. (optional)

Has anyone any suggestions?

Thanks for help

Had a mistake in the title. It is BUTTON_LEFT (not BUTTON_RIGHT) event.

There is a connection to this entry:


I think I now have completely understand the problem and I think there is no solution for it.
Can anyone confirm??

What happens:

  • the user click the table row. Row is marked.
  • event listener ist triggered and in another tab a tree is modified (mark the corresponding element in the tree).
  • the user wanted not only to click he/she wanted to mark text → click event was triggered and the text is no longer selected (the selection is removed when the button up event is triggered which causes a mous click event, because mouse button down and up is not triggered separately).

What happens?
The listener modifies the tree - an element is marked. When this happens, the table where the user clicked looses focus which leads in loosing the selection.

My analysis: This problem can not be solved. Only using a workaround (for example using ctrl-key when selecting text or something else).

Solution would be:

  • collecting all changes
  • apply those changes inside tab X, when the tab X is opened (get focus) by the user → the user click the tab.

What do you think?