insertimagecommand.java

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

JAVA
47
字号
/* * @(#)InsertImageCommand.java 5.1 * */package CH.ifa.draw.figures;import java.util.*;import java.awt.*;import CH.ifa.draw.util.*;import CH.ifa.draw.framework.*;import CH.ifa.draw.standard.*;/** * Command to insert a named image. */public class InsertImageCommand extends Command {    private DrawingView  fView;    private String       fImage;   /**    * Constructs an insert image command.    * @param name the command name    * @param image the pathname of the image    * @param view the target view    */    public InsertImageCommand(String name, String image, DrawingView view) {        super(name);        fImage = image;        fView = view;    }    public void execute() {        // ugly cast to component, but AWT wants and Component instead of an ImageObserver...        Image image = Iconkit.instance().registerAndLoadImage((Component)fView, fImage);        ImageFigure figure = new ImageFigure(image, fImage, fView.lastClick());        fView.add(figure);        fView.clearSelection();        fView.addToSelection(figure);        fView.checkDamage();    }}

⌨️ 快捷键说明

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