📄 createundoableedit.java
字号:
package com.sunking.tp.undoredo;
import java.awt.*;
import javax.swing.undo.*;
import com.sunking.tp.framework.*;
import com.sunking.tp.util.*;
/**
* <p>Title: CreateUndoableEdit</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author <a href="mailto:sunkingxie@hotmail.com">SunKing</a>
* @version 1.0
*/
public class CreateUndoableEdit extends AbstractUndoableEdit {
public final static int CREATE_JTPBUTTON = 0;
public final static int CREATE_JTPTEXTAREA = 1;
public final static int CREATE_JTPIMAGE = 2;
int type = -1;
JTPComponent com;
Desktop desk;
public CreateUndoableEdit(int type, Desktop desk, JTPComponent com) {
this.type = type;
this.com = com;
this.desk = desk;
}
String getPresentationNameOfType() {
switch (type) {
case CREATE_JTPBUTTON:
return "JTPButton";
case CREATE_JTPTEXTAREA:
return "JTPTextArea";
default:
return "JTPImage";
}
}
public String getUndoPresentationName() {
return JTPUtil.getString("Undo_Create") + getPresentationNameOfType();
}
public String getRedoPresentationName() {
return JTPUtil.getString("Redo_Create") + getPresentationNameOfType();
}
public void undo() throws CannotUndoException {
super.undo();
( (Container) desk).remove( (Component) com);
desk.fireAssoicatorChanged();
}
public void redo() throws CannotRedoException {
super.redo();
( (Container) desk).add( (Component) com);
desk.fireAssoicatorChanged();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -