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

📄 line.java

📁 svg gwt 监控软件 大的 大 发了佛法ffffffffff发的司法
💻 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;
import com.mc.svg.shape.supershape.Node;

public class Line extends AbstractShape {
	
	public Line(Document doc) {
		this.doc = doc;
		root = doc.createElementNS(SVGCanvas.svgNS, "line");
	}
	
	public Line(Document doc,Point point1, Point point2) {
		this.doc = doc;
		root = doc.createElementNS(SVGCanvas.svgNS, "line");
		

		setBeginPoint(point1);

		setEndPoint(point2);

	}
	
	public Line(Node node1, Node node2) {
		this.doc = node1.getDocument();
		root = doc.createElementNS(SVGCanvas.svgNS, "line");
		Point point1 = new Point();

		point1.x = node1.getX();
		point1.y = node1.getY();

		setBeginPoint(point1);

		Point point2 = new Point();

		point2.x = node2.getX();
		point2.y = node2.getY();

		setEndPoint(point2);

	}

	public void setBeginPoint(Point point) {
		root.setAttributeNS(null, "x1", point.x + "");
		root.setAttributeNS(null, "y1", point.y + "");
	}

	public void setEndPoint(Point point) {

		root.setAttributeNS(null, "x2", point.x + "");
		root.setAttributeNS(null, "y2", point.y + "");

	}

	public void setLineColor(Color color) {
		String linecol = GenColor.genColor(color);
		root.setAttributeNS(null,"stroke", linecol);
	}
	
	public void setLineWidth(int width){
		root.setAttributeNS(null,"stroke-width",width+"");
	}

}

⌨️ 快捷键说明

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