bernardlejour
IS-IT--Management
I am new to the language. I have written an applet that displays a vertical scrolling text window. I want the text displayed to be centered. I use the drawString instruction to show the text which has multiple lines and I loop through. My problem is the centering of each line of text. I have to instruct drawString x and y coordinates but I presently have to figure it out manually by trial and error. Leaving blanks in front does not solve the problem because the blanks do not take the same space as regular characters.
Is there a way to center the text (calculate the number of pixels used by a given string) or is there a better method to achieve what I want to do?
Is there a way to center the text (calculate the number of pixels used by a given string) or is there a better method to achieve what I want to do?