本文整理汇总了Java中org.openide.awt.UndoRedo.undo方法的典型用法代码示例。如果您正苦于以下问题:Java UndoRedo.undo方法的具体用法?Java UndoRedo.undo怎么用?Java UndoRedo.undo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.awt.UndoRedo
的用法示例。
在下文中一共展示了UndoRedo.undo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUndoTask
import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
/** Creates <code>Runnable</code> which tries to make one undo. Helper method.
* @see #revertUpcomingUndo */
private Runnable createUndoTask() {
return new Runnable() {
public void run() {
StyledDocument sd = doc;
if(sd == null) {
// #20883, doc can be null(!), doCloseDocument was faster.
return;
}
UndoRedo ur = getUndoRedo();
sd.removeDocumentListener(getListener());
try {
if(ur.canUndo()) {
Toolkit.getDefaultToolkit().beep();
ur.undo();
}
} catch(CannotUndoException cne) {
ErrorManager.getDefault().notify(
ErrorManager.INFORMATIONAL, cne);
} finally {
sd.addDocumentListener(getListener());
}
}
};
}
示例2: performAction
import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
public void performAction() {
try {
UndoRedo undoRedo = getUndoRedo();
if (undoRedo.canUndo()) {
undoRedo.undo();
}
} catch (CannotUndoException ex) {
UndoRedoAction.cannotUndoRedo(ex);
}
updateStatus();
}
示例3: performAction
import org.openide.awt.UndoRedo; //导入方法依赖的package包/类
public void performAction() {
try {
UndoRedo undoRedo = getUndoRedo ();
if (undoRedo.canUndo ()) {
undoRedo.undo ();
}
} catch (CannotUndoException ex) {
ErrorManager.getDefault ().notify (ex);
}
updateStatus();
}