I have a windows explorer type split-pane. directory tree on the left and file/info table on right.
When the user right clicks it brings up a pop-up menu; but like in Eclipse (for example) i would like to select the entry they are over when they right-click before bringing up the pop-up menu.
I realise that this will probably work like this for JTable:
public void mouseClicked(MouseEvent evt)
if (evt is right-click)
Point origin = evt.getPoint();
int row = table.rowAtPoint(origin);
if (row != -1)
but how does it work for JTree. Also - the popup-trigger is used for bringing up the popup menu - should this have the same effect I described above (example the apple mac keyboard trigger - should this also make the row the mouse is over be selected before performing the popup.
Last of all - will this right-click functionality described above happen before the pop-up menu is brought up? does it have to?