⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 panel.java

📁 svg gwt 监控软件 大的 大 发了佛法ffffffffff发的司法
💻 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 + -