You can call the graphcomponent class's getCellAt(int x, int y)
method with the MouseEvent class's getX()
and getY()
methods. This will return you an object if there is a vertex (or edge) where you clicked, then with a simple comparison you can decide which vertex is it.
Here is an example:
graphComponent.getGraphControl().addMouseListener(new MouseAdapter()
{
@Override
public void mouseReleased(MouseEvent e)
{
mxCell cell =(mxCell) getGraphComponent().getCellAt(e.getX(), e.getY());
if(cell != null && cell.equals(YOUR_VERTEX))
{
//specific thing you want to do on click
}
}
});