ellipse.java

来自「GEF初学者可以用来对照的小例子」· Java 代码 · 共 49 行

JAVA
49 行
字号
package com.dss.moon.gef.model;

import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;



public class Ellipse extends Subject{
	
	protected Point Location = new Point(0,0);
	protected Dimension size = new Dimension(0,0);
	private Rectangle constraint = new Rectangle(Location,size);

	public Point getLocation() {
		return Location;
	}

	public Dimension getSize() {
		return size;
	}

	public void setSize(Dimension s) {
		if(size.equals(s))
			return;
		size = s;
		firePropertyChange("size",null,s);
	}

	public void setLocation(Point p) {
		
		if(Location.equals(p))
			return;
		Location = p;
		firePropertyChange("location",null,p);//��֪Diagram����location�ĸı�
	}

	public void setConstraint(Rectangle con){
		if(constraint.equals(con))
			return;
		constraint = con;
		firePropertyChange("constraint", null, constraint);
	}
	
	public Rectangle getConstraint(){
		return constraint;
	}
}

⌨️ 快捷键说明

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