简体   繁体   中英

Adding ActionListener to the mxcell in JGraphX

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

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
}
}
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM