This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Im trying to print a multiline string Im using drawString(String s, x, y) and the string is a multiple line String but yet when I print it; it comes as a single line of text. Can someone help ------------------
When you use drawString, you are painting something not "printing" it. And Graphics is not a Text based class, and does not understand things like linefeeds. You could either have a drawString for each line that you want to print (you would need to work out the next lines starting coordinates based on the particular font that you are using), or use a text based class to get the string printed. What is it exactly that you are trying to accomplish? Could you just use a Label or something like that? Here is a link that shows how to make a multi line label by sub-classing canvas. http://www1.uni-bremen.de/~wboeck/java/javabook/javabo74.htm
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Nov 03, 2000
I have numerous textfields which are filled by the user and he has the option to print. So im trying to sting all the stings together. So I would like something like this String s = "text1 \n" + "text2\n" + ..........."text20\n"; what class would allow me to to something like this thank u ------------------