📄 propertytext.java
字号:
package com.mc.svg.shape.supershape;
import java.awt.Color;
import java.awt.Point;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import com.mc.svg.shape.basicshape.Line;
import com.mc.svg.shape.basicshape.Rectangle;
import com.mc.svg.shape.basicshape.Text;
public class PropertyText {
private int x = 0;
private int y = 0;
public static int height = 24;
private Line line = null;
private Text nameText = null;
private Rectangle rect = null;
private Text valueText = null;
public PropertyText(Document doc,String name,String value){
nameText = new Text(doc);
nameText.setText(name);
nameText.setStyle("stroke: black; font-size: 20px; pointer-events: none");
valueText = new Text(doc);
valueText.setText(value);
valueText.setStyle("stroke: black; font-size: 20px; pointer-events: none");
line = new Line(doc);
line.setLineColor(Color.BLACK);
rect = new Rectangle(doc);
rect.setFillColor(Color.WHITE);
rect.setBorderColor(Color.BLACK);
}
public void setLocation(int x,int y,int width,int h){
rect.setLocation(x,y);
rect.setSize(width,height);
Point p1 = new Point();
p1.setLocation(x+width/2,y);
line.setBeginPoint(p1);
Point p2 = new Point();
p2.setLocation(x+width/2,y+height);
line.setEndPoint(p2);
nameText.setLocation(x+10,y+height-2);
valueText.setLocation(x+10+width/2,y+height-2);
}
public Element getNameText() {
return nameText.getElement();
}
public void setNameText(Text nameText) {
this.nameText = nameText;
}
public Element getRect() {
return rect.getElement();
}
public void setRect(Rectangle rect) {
this.rect = rect;
}
public Element getValueText() {
return valueText.getElement();
}
public void setValueText(Text valueText) {
this.valueText = valueText;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public Element getLine() {
return line.getElement();
}
public void setLine(Line line) {
this.line = line;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -