You add a MouseListener
to the table, and you check for the following things:
- Clicked button is mouse right-click.
- The pointer of the event is located within the bounds of your table item (i.e. your first
TableItem
- you will usetable.getItem(Point)
).
If these conditions are met, you open the menu at mouse location.