0

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 ?.

Frodo Baggins
  • 8,290
  • 6
  • 45
  • 55
Leks
  • 77
  • 11

1 Answers1

1

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
}
}
}
Leks
  • 77
  • 11