有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (1) 个答案

  1. # 1 楼答案

    创建一个名为“标签线”的类,并使其类似于

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

    在谷歌上快速绘制有角度的文本,我得到了一些结果,所以这应该很容易做到