我想在JGraphX的mxcell(顶点)中添加"Action Listener“。如果我双击mxcell顶点,它应该会执行一些操作。有没有办法将动作侦听器添加到jGraphX中的mxcell顶点?
发布于 2016-05-04 22:04:13
单击图形组件上的鼠标单击事件,获取单元格并将操作事件添加到该单元格。
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
}
}
}https://stackoverflow.com/questions/36639303
复制相似问题