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

📄 changeattributecommand.java

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

package CH.ifa.draw.standard;

import java.awt.Color;
import CH.ifa.draw.framework.*;
import CH.ifa.draw.util.*;

/**
 * Command to change a named figure attribute.
 */
public  class ChangeAttributeCommand
        extends Command {

    private DrawingView fView;
    private String      fAttribute;
    private Object      fValue;

   /**
    * Constructs a change attribute command.
    * @param name the command name
    * @param attributeName the name of the attribute to be changed
    * @param value the new attribute value
    * @param view the target view
    */
    public ChangeAttributeCommand(String name, String attributeName,
                           Object value, DrawingView view) {
        super(name);
        fAttribute = attributeName;
        fValue = value;
        fView = view;
    }

    public void execute() {
        FigureEnumeration k = fView.selectionElements();
        while (k.hasMoreElements()) {
            Figure f = k.nextFigure();
            f.setAttribute(fAttribute, fValue);
        }
        fView.checkDamage();
    }

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

}


⌨️ 快捷键说明

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