コード例 #1
0
ファイル: VRedoButton.java プロジェクト: timburrow/ovj3
 public void undoableEditHappened(UndoableEditEvent e) {
   UndoManager mgr = Undo.getCurrentUndoMgr();
   if (mgr != null && mgr.canRedo()) {
     setToolTipText(mgr.getRedoPresentationName());
     setEnabled(true);
   } else {
     setToolTipText(tipStr);
     setEnabled(false);
   }
 }
コード例 #2
0
  /**
   * Refreshes the undo/redo icons with the last action performed.
   *
   * @param oUndoManager, the manager to use to check for undo/redo possibilities.
   */
  public void refreshUndoRedo(UndoManager oUndoManager) {

    // refresh undo
    pbUndo.setToolTipText(oUndoManager.getUndoPresentationName());
    pbUndo.setEnabled(oUndoManager.canUndo());

    // refresh redo
    pbRedo.setToolTipText(oUndoManager.getRedoPresentationName());
    pbRedo.setEnabled(oUndoManager.canRedo());
  }