`
cuijunrong
  • 浏览: 8989 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论

jgraph 之 撤销与恢复

阅读更多
JGraph graph = null;
graph = new JGraph(model, view);

GraphUndoManager undoManager = null;

undoManager = new GraphUndoManager();

graph.getModel().addUndoableEditListener(undoManager);

/**
* 撤销
*/
public void undo() {
// Register UndoManager with the Model
try {
undoManager.undo();
} catch (CannotUndoException e) {
e.printStackTrace();
}
}

/**
* redo
*/
public void redo() {
// Register UndoManager with the Model
try {
undoManager.redo();
} catch (CannotRedoException e) {
e.printStackTrace();
}
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics