Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 JGraph 附带的示例 mxGraph 编辑器。我有一个方法,每次创建新节点时都想调用它。你知道怎么做吗?
我觉得它与 mxGraphComponent 有关,但我不知道该怎么做。
查看mxGraph该类的 API 文档。它会触发一些细粒度的事件来指定发生了哪些更改。您很可能对mxEvent.CELLS_ADDED. 所以添加一个监听器:
mxGraph
mxEvent.CELLS_ADDED
graph.addListener(mxEvent.CELLS_ADDED, myHandler);
其中 myHandler 实现了mxIEventListener需要实现调用方法的接口(触发事件时调用的方法)。
mxIEventListener