?? abstractshape.java
字號:
package com.mc.svg.shape;
import java.awt.Point;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import com.mc.svg.script.Function;
public abstract class AbstractShape implements Shape {
protected Element root = null;
protected Element parent = null;
protected String id = null;
protected Document doc = null;
public Element getElement() {
return root;
}
public Document getDocument() {
return doc;
}
public void setId(String str) {
id = str;
root.setAttribute("id", str);
}
public String getId() {
return id;
}
public Element getParentElement() {
return parent;
}
public void setLocation(int x, int y) {
root.setAttribute("x", x + "");
root.setAttribute("y", y + "");
}
public void setParentElement(Element e) {
parent = e;
}
public void setDocument(Document doc) {
this.doc = doc;
}
public Point getLocation() {
String xStr = root.getAttribute("x");
String yStr = root.getAttribute("y");
int x = 0;
int y = 0;
try {
x = Integer.parseInt(xStr);
y = Integer.parseInt(yStr);
} catch (Exception ex) {
}
return new Point(x, y);
}
public int getX() {
String xStr = root.getAttribute("x");
int x = 0;
try {
x = Integer.parseInt(xStr);
} catch (Exception ex) {
}
return x;
}
public int getY() {
String yStr = root.getAttribute("y");
int y = 0;
try {
y = Integer.parseInt(yStr);
} catch (Exception ex) {
}
return y;
}
public void addMouseOver(String functionName, String[] params) {
String str = Function.functionDispose(functionName, params);
root.setAttributeNS(null, "onmouseover", str);
}
public void addMouseOut(String functionName, String[] params) {
String str = Function.functionDispose(functionName, params);
root.setAttributeNS(null, "onmouseout", str);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -