?? circle.java
字號:
package com.mc.svg.shape.basicshape;
import java.awt.Color;
import java.awt.Point;
import org.w3c.dom.Document;
import com.mc.svg.GenColor;
import com.mc.svg.SVGCanvas;
import com.mc.svg.shape.AbstractShape;
public class Circle extends AbstractShape {
public Circle(Document doc) {
this.doc = doc;
root = doc.createElementNS(SVGCanvas.svgNS,"circle");
}
public void setRadius(int r) {
root.setAttribute("r", r+"");
}
public void setCenterPoint(int x, int y) {
root.setAttribute("cx", x + "");
root.setAttribute("cy", y + "");
}
public void setFillColor(Color color) {
String str = GenColor.genColor(color);
root.setAttributeNS(null, "fill", str);
}
public Point getCenterPoint(){
String cxStr = root.getAttribute("cx");
String cyStr = root.getAttribute("cy");
int cx = 0;
int cy = 0;
try {
cx = Integer.parseInt(cxStr);
cy = Integer.parseInt(cyStr);
} catch (Exception ex) {
}
Point point = new Point(cx,cy);
return point;
}
public void addAnimateMotion(AnimateMotion motion){
root.appendChild(motion.getElement());
}
public int getRadius() {
String widthStr = root.getAttribute("r");
int width = 0;
try {
width = Integer.parseInt(widthStr);
} catch (Exception ex) {
}
return width;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -