figuretransfercommand.java

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

JAVA
63
字号
/* * @(#)FigureTransferCommand.java 5.1 * */package CH.ifa.draw.standard;import java.util.*;import CH.ifa.draw.util.*;import CH.ifa.draw.framework.*;/** * Common base clase for commands that transfer figures * between a drawing and the clipboard. */abstract class FigureTransferCommand extends Command {    protected DrawingView fView;   /**    * Constructs a drawing command.    * @param name the command name    * @param view the target view    */    protected FigureTransferCommand(String name, DrawingView view) {        super(name);        fView = view;    }   /**    * Deletes the selection from the drawing.    */    protected void deleteSelection() {       fView.drawing().removeAll(fView.selection());       fView.clearSelection();    }   /**    * Copies the selection to the clipboard.    */    protected void copySelection() {        FigureSelection selection = fView.getFigureSelection();        Clipboard.getClipboard().setContents(selection);    }   /**    * Inserts a vector of figures and translates them by the    * given offset.    */    protected void insertFigures(Vector figures, int dx, int dy) {        FigureEnumeration e = new FigureEnumerator(figures);        while (e.hasMoreElements()) {            Figure figure = e.nextFigure();            figure.moveBy(dx, dy);            figure = fView.add(figure);            fView.addToSelection(figure);        }    }}

⌨️ 快捷键说明

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