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

📄 image.java

📁 svg gwt 监控软件 大的 大 发了佛法ffffffffff发的司法
💻 JAVA
字号:
package com.mc.svg.shape.basicshape;

import org.w3c.dom.Document;

import com.mc.svg.SVGCanvas;
import com.mc.svg.shape.AbstractShape;

public class Image extends AbstractShape {

	public Image(Document doc,String imagePath) {
		this.doc = doc;

		root = doc.createElementNS(SVGCanvas.svgNS, "image");
		root.setAttributeNS(null, "xlink:href", imagePath);
	}
	
	public Image(Document doc) {
		this.doc = doc;

		root = doc.createElementNS(SVGCanvas.svgNS, "image");
	}

	public void setImagePath(String imagePath) {
		root.setAttributeNS(null, "xlink:href", imagePath);
	}
	
	public void addOnClick(String str){
		String tmp = "locationUrl('"+str+"')";
		root.setAttributeNS(null,"onclick",tmp);
	}
	

	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;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -