class LabeledLine {
private int x1, y1, x2, y2;
private String label;
public void drawOn(Graphics g) {
// need more features? thickness, etc? add it
g.drawLine(x1,y1,x2,y2);
// compute size of text, position of text, angle of text
// draw that text
}
}
# 1 楼答案
创建一个名为“标签线”的类,并使其类似于
在谷歌上快速绘制有角度的文本,我得到了一些结果,所以这应该很容易做到