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

📄 groupcommand.java

📁 开源(Open Source)项目JHotDraw的文档和源程序
💻 JAVA
字号:
/*
 * @(#)GroupCommand.java 5.2
 *
 */

package CH.ifa.draw.figures;

import java.util.*;
import CH.ifa.draw.util.Command;
import CH.ifa.draw.framework.*;
import CH.ifa.draw.standard.*;

/**
 * Command to group the selection into a GroupFigure.
 *
 * @see GroupFigure
 */
public  class GroupCommand extends Command {

    private DrawingView fView;

   /**
    * Constructs a group command.
    * @param name the command name
    * @param view the target view
    */
    public GroupCommand(String name, DrawingView view) {
        super(name);
        fView = view;
    }

    public void execute() {
        Vector selected = fView.selectionZOrdered();
        Drawing drawing = fView.drawing();
        if (selected.size() > 0) {
            fView.clearSelection();
            drawing.orphanAll(selected);

            GroupFigure group = new GroupFigure();
            group.addAll(selected);
            fView.addToSelection(drawing.add(group));
        }
        fView.checkDamage();
    }

    public boolean isExecutable() {
        return fView.selectionCount() > 0;
    }

}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -