各位:谁有画图版的编辑中的"撤消""重复"的原代码.麻烦发一个好吗?发到这上面或者我的信箱中[email protected]不胜感激!

解决方案 »

  1.   

    我做过简单的只处理添加图形和删除图形的撤消和恢复,你可以参考一下定义一个Opeate类,每一步操作都构造一个对象
    public class Operate {
        public AllPoint ap;
        public int type;
        public String sql;
        
        public static final int OPERATE_ADD = 1;
        public static final int OPERATE_DEL = 2;
        
        public Operate(AllPoint ap,int type, String sql){
            this.ap = ap;
            this.type = type;
            this.sql = sql;
        }
        
        public String toString(){
            return "type="+type+",ap="+ap;
        }
    }然后定义一个Vector之类的存放已经进行的操作。撤消时,取出上一步的操作,然后反向处理就
      

  2.   

    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html这里有例子。不过是个文本的。
      

  3.   

    各位: 我现在能把每一个操作的动作都保存在vector中.但是如何取出?如何更新显示在画布上思维很混乱,看了楼上提供的资料还是不很清楚.很希望能有一个事例代码!希望高人帮忙.感激涕零