當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。