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

📄 movecommand.java

📁 GEF基础源码
💻 JAVA
字号:
package com.jixy.study.gef.util;

import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.commands.Command;

import com.jixy.study.gef.model.Ellipse;

public class MoveCommand extends Command {
	private Ellipse node;

	private Point newPos;

	private Point oldPos;

	public void setLocation(Point p) {
		this.newPos = p;
	}

	public void setNode(Ellipse node) {
		this.node = node;
	}

	public String getLabel() {
		return "Move Node";
	}

	public void execute() {
		oldPos = this.node.getLocation();
		this.node.setLocation(newPos);
	}

	public void undo() {
		this.node.setLocation(oldPos);
	}

	public void redo() {
		this.node.setLocation(newPos);
	}
}

⌨️ 快捷键说明

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