Reputation: 77
I want to add "Action Listener" to the mxcell(vertex) in JGraphX. If I Double Clicked on the mxcell vertex it should do some action. Is there any way to add action listener to the mxcell vertex in jGraphX ?.
Upvotes: 0
Views: 787
Reputation: 77
On mouse click event on the graph component get the cell and add action event to the cell.
public void mouseClicked(MouseEvent e)
{
Object cell=graphComponent.getCellAt(e.getX(),e.getY());
if(cell!=null&& cell instanceof mxcell)
{
if(((mxcell)cell.getValue().toString().equals("cell-name"))
{
// your function
}
}
}
Upvotes: 1