📄 polygonhandle.java
字号:
/*
* Fri Feb 28 07:47:13 1997 Doug Lea (dl at gee)
* Based on PolyLineHandle
*/
package CH.ifa.draw.contrib;
import java.awt.*;
import java.util.*;
import java.io.IOException;
import CH.ifa.draw.framework.*;
import CH.ifa.draw.util.*;
import CH.ifa.draw.standard.*;
/**
* A handle for a node on the polygon.
*/
public class PolygonHandle extends AbstractHandle {
private int fIndex;
private Locator fLocator;
/**
* Constructs a polygon handle.
* @param owner the owning polygon figure.
* @l the locator
* @index the index of the node associated with this handle.
*/
public PolygonHandle(PolygonFigure owner, Locator l, int index) {
super(owner);
fLocator = l;
fIndex = index;
}
public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) {
myOwner().setPointAt(new Point(x, y), fIndex);
}
public void invokeEnd (int x, int y, int anchorX, int anchorY, DrawingView view) {
myOwner().smoothPoints();
}
public Point locate() {
return fLocator.locate(owner());
}
private PolygonFigure myOwner() {
return (PolygonFigure)owner();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -