⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createundoableedit.java

📁 说明 功能: 可对组件进行选取删除复制粘贴等动作 可进行两组件之间的连线 可在多组件之问交叉连 可创建多种形式的连线(目前包括无箭头空心箭头实心箭头)
💻 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 + -