I am boggled with this, being new to Java and all. Why is it that the following code will not allow me to print TABS in strings? (i.e., tabs="testing\tone\ttwo\tthree" Here is my code:
if you don't know, then ask. if you do know, then share. love is knowledge.
I should have added that when I run that code (using Java 1.4.1_01 on the Debian operating system), it just prints out that string with all the words crammed together, inside the box. This is wierd.
if you don't know, then ask. if you do know, then share. love is knowledge.
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.
if you don't know, then ask. if you do know, then share. love is knowledge.
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?
if you don't know, then ask. if you do know, then share. love is knowledge.