0

System.out.println("How \n are \n you"); produces:

How
Are
You

Like expected. But...

g.drawString("How \n are \n you", xPos, yPos); produces:

How are you

without the proper indentation. I understand I could just draw the string three separate times, each time lowering the y coordinate, like so:

g.drawString("How", xPos, yPos);
g.drawString("are", xPos, lowerYPos);
g.drawString("you", xPos, evenLowerYPos);

but this just seems sloppy. Is there a way to indent using g.drawString();?

0 Answers0