当前位置: 首页>>代码示例>>Java>>正文


Java UndoManager.canUndo方法代码示例

本文整理汇总了Java中javax.swing.undo.UndoManager.canUndo方法的典型用法代码示例。如果您正苦于以下问题:Java UndoManager.canUndo方法的具体用法?Java UndoManager.canUndo怎么用?Java UndoManager.canUndo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.undo.UndoManager的用法示例。


在下文中一共展示了UndoManager.canUndo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onUndo

import javax.swing.undo.UndoManager; //导入方法依赖的package包/类
public void onUndo() {
	if(undoManager.canUndo() && hasChanges) {
		undoManager.undo();
	} else {
		// HACK need to call parent frames undo if we have no changes
		CommonModuleFrame cmf = CommonModuleFrame.getCurrentFrame();
		if(cmf == null) return;

		final UndoManager cmfUndoManager = cmf.getExtension(UndoManager.class);
		if(cmfUndoManager != null && cmfUndoManager.canUndo()) {
			 cmfUndoManager.undo();

			 // reset this flag - otherwise the group undo manager
			 // will attempt to undo with 'nothing' as last value
			 hasChanges = false;
		}
	}
}
 
开发者ID:phon-ca,项目名称:phon,代码行数:19,代码来源:GroupField.java

示例2: undo

import javax.swing.undo.UndoManager; //导入方法依赖的package包/类
public static void undo(Context context, final int count) throws Exception {
    final UndoManager undoManager = getValidUndoManager(context);
    logUndoRedoOp(context, "UNDO", count);
    int cnt = count;
    while (undoManager.canUndo() && --cnt >= 0) {
        undoManager.undo();
        checkContent(context);
    }
    logPostUndoRedoOp(context, cnt);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:DocumentContentTesting.java

示例3: run

import javax.swing.undo.UndoManager; //导入方法依赖的package包/类
@Override
protected void run(CsvGridSheetCellValuePanel valuePanel) {
  UndoManager um = valuePanel.getUndoManager();
  if (um.canUndo()) {
    um.undo();
  } else {
    abort();
  }
}
 
开发者ID:kohii,项目名称:smoothcsv,代码行数:10,代码来源:UndoCommand.java

示例4: createUndoAction

import javax.swing.undo.UndoManager; //导入方法依赖的package包/类
@SuppressWarnings("serial")
public static Action createUndoAction(final UndoManager undoManager, String name) {
	return new AbstractAction(name) {
           public void actionPerformed(ActionEvent arg0) {
               if (undoManager.canUndo()) {
                   undoManager.undo();
               }
           }
       };
}
 
开发者ID:nativelibs4java,项目名称:JNAerator,代码行数:11,代码来源:FormUtils.java

示例5: actionPerformed

import javax.swing.undo.UndoManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
    try {
        UndoManager currentManager = undoManageTeam.getCurrentManager();
        if (currentManager.canUndo())
            currentManager.undo();
    } catch (CannotUndoException exceptionInfo) {
        //Ignore the exception.
    }
}
 
开发者ID:Carrotlord,项目名称:MintChime-Editor,代码行数:11,代码来源:MainGui.java


注:本文中的javax.swing.undo.UndoManager.canUndo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。