ungroupcommand.java

来自「JHotDraw学习过程中对数组的测试程序haha 学习过程中对数组的测试程序」· Java 代码 · 共 51 行

JAVA
51
字号
/* * @(#)UngroupCommand.java 5.1 * */package CH.ifa.draw.figures;import java.awt.*;import java.util.*;import CH.ifa.draw.framework.*;import CH.ifa.draw.util.Command;/** * Command to ungroup the selected figures. * @see GroupCommand */public  class UngroupCommand extends Command {    private DrawingView fView;   /**    * Constructs a group command.    * @param name the command name    * @param view the target view    */    public UngroupCommand(String name, DrawingView view) {        super(name);        fView = view;    }    public void execute() {        FigureEnumeration selection = fView.selectionElements();        fView.clearSelection();        Vector parts = new Vector();        while (selection.hasMoreElements()) {            Figure selected = selection.nextFigure();            Figure group = fView.drawing().orphan(selected);            FigureEnumeration k = group.decompose();            while (k.hasMoreElements())                fView.addToSelection(fView.add(k.nextFigure()));        }        fView.checkDamage();    }    public boolean isExecutable() {        return fView.selectionCount() > 0;    }}

⌨️ 快捷键说明

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