如何使用 drawString 在多行中重复其字符,然后在每行中添加另一个字符?

How do you use a drawString to repeat its character on multiple lines but then add another character as it goes down each line?

public class graphic {
    public static final int L = 10;

    public static void main(String[] args) {
        face(g,(L/2)*2, 20);
    }

    public static void face (Graphics g, int x, int y){
        int e = (x+1)*10;
        int d = x*3; 
        int h = y+8+(x-1)*16;
        for (int z= 2; z<x; z++){
            g.drawString("__/", ((e-(x*8))+d*8)+((x-3)*8)-24-(32*(z-2)),(h-(x-1)*16)+ (z*16));
        }
    }
}

使用这个 forloop,我想在第一行生成一个 __/,然后在第二行生成一个 __/,然后在第二行生成一个,依此类推,直到第八行,它总共打印八个并停止。到目前为止,它每行只打印一个 __/ 。我需要在我的代码中更改什么,以便它在一行上打印 __/ 然后在下一行增加 1?

您只需使用绘制的变量,并在 for 循环中更新变量。

String str = "stuff";
For(){
Draw method you have
Str = str + "stuff";
}