Drawing out reversed Strings with Graphics.drawString

140 views Asked by At

What I want to do is printing out Numbers as a String via Graphics.drawString.

They will be the scale for an coordinate system which looks like this:

coordinate system

As you can see its reversed, negative numbers in positive y-direction and positve in negative y-direction, which, obviously, is wrong.

To generate them I use the following simple for-condition:

for (int i =  -y; i<=y; i++){
            stift.drawString(""+(i-12), canvas.getWidth()/2, i*scale+4);}

where y describes the total length (12 negative + 12 positive numbers = 24 in total in this case). I tried multiple times but couldnt figure out how to change the for condition in order to reverse the drawn Strings so they are ordered correctly.

Could you please give me an explanation and solution? Best Regards.

0

There are 0 answers