posted 23 years ago
Hi!
Here is a part of my method mouseClicked(MouseEvent e) in the class implementing MouseListener:
public void mouseClicked(MouseEvent e)
{
if ((e.getModifiers() & InputEvent.BUTTON3_MASK)== InputEvent.BUTTON3_MASK)
{
Point pLoc = e.getPoint();
TreePath destPath = tree.getPathForLocation(pLoc.x,pLoc.y);
if (destPath!=null)
tree.setSelectionPath(destPath);
}
It is very easy.
Hope it will help you.
Ciao!