?? panel.java
字號:
package com.mc.svg.shape;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
public abstract class Panel extends AbstractShape {
private List nodes = new ArrayList();
public void setSize(int width, int height) {
root.setAttributeNS(null, "width", width + "");
root.setAttributeNS(null, "height", height + "");
}
public int getWidth() {
String widthStr = root.getAttribute("width");
int width = 0;
try {
width = Integer.parseInt(widthStr);
} catch (Exception ex) {
}
return width;
}
public int getHeight() {
String heightStr = root.getAttribute("width");
int height = 0;
try {
height = Integer.parseInt(heightStr);
} catch (Exception ex) {
}
return height;
}
public int getChildCount() {
return nodes.size();
}
@SuppressWarnings("unchecked")
public void add(Shape shape) {
root.appendChild(shape.getElement());
nodes.add(shape);
}
@SuppressWarnings("unchecked")
public void remove(Shape shape) {
root.removeChild(shape.getElement());
nodes.remove(shape);
}
public void setFillColor(Color color) {
String a = Integer.toHexString(color.getRed());
String b = Integer.toHexString(color.getBlue());
String c = Integer.toHexString(color.getGreen());
String str = "#" + a + b + c;
root.setAttributeNS(null, "fill", str);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -