I am looking to use a Graphics2D object to draw a string to the screen char by char, having them fade in.

I initially split the string into chars, and drew each individual char but ran into issues with proper spacing between each letter (as each letter is a different amount of pixels.) Is there an easy way to accomplish this?

g.drawString(currentLine(j), 250, 770+j*20);


        for(int i = 0; i < currentLine(j).length(); i++) {
            String chr = new StringBuilder().append("").append(currentLine(j).charAt(i)).toString();
            g.drawString(chr, 250+i*10, 770+j*20);

0 Answers