This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
It seems like the drawString() method doesn't know how to deal with special characters, such as tab. I would suggest you split the String up and use separate drawString() calls with the appropriate x and y arguments to position them where you want.
Thanks Surely there is some other way to do this? Using separate drawString() methods is rather inefficient, isn't it? The Deitel & Deitel book just mentioned the "\t" character, but didn't give an example using it. Now I know why, considering that the character was mentioned in Chapter 2, I believe.
Joined: Dec 06, 2001
Well, if you are doing a text-based program, the \t character can be quite useful. It will print as expected if you do something like
Joined: Aug 26, 2001
Correct, but that isn't what I want. I want to do this within an applet. Can it just not be done without sprinkling drawString() methods for every word to be tabbed?