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

📄 pastecommand.java

📁 JHotDraw学习过程中对数组的测试程序haha 学习过程中对数组的测试程序
💻 JAVA
字号:
/* * @(#)PasteCommand.java 5.1 * */package CH.ifa.draw.standard;import java.util.*;import java.awt.*;import CH.ifa.draw.util.*;import CH.ifa.draw.framework.*;/** * Command to insert the clipboard into the drawing. * @see Clipboard */public class PasteCommand extends FigureTransferCommand {   /**    * Constructs a paste command.    * @param name the command name    * @param image the pathname of the image    * @param view the target view    */    public PasteCommand(String name, DrawingView view) {        super(name, view);    }    public void execute() {        Point lastClick = fView.lastClick();        FigureSelection selection = (FigureSelection)Clipboard.getClipboard().getContents();        if (selection != null) {            Vector figures = (Vector)selection.getData(FigureSelection.TYPE);            if (figures.size() == 0)                return;            Rectangle r = bounds(figures.elements());            fView.clearSelection();            insertFigures(figures, lastClick.x-r.x, lastClick.y-r.y);            fView.checkDamage();        }    }    Rectangle bounds(Enumeration k) {        Rectangle r = ((Figure) k.nextElement()).displayBox();        while (k.hasMoreElements())            r.add(((Figure) k.nextElement()).displayBox());        return r;    }}

⌨️ 快捷键说明

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