I am trying to print text from a JTextPane and can only get a blank page or a single line. Below is the code I am using. This code produces the blank page.
If is use g2D.drawString(getText(), x, y), then my application prints one line of text from the JTextPane and ignores the newline characters. What am I doing wrong? How should I go about this? I decided to use a JTextPane since I will need to print HTML documents and the JTextPane can render this for me. Thanks, Steve
drawString() is NOT a text processing method, it just paints a picture of the text - on a single line. To do multiple lines you would need to break the string up into lines and paint each line separately. Printing API: A Tutorial
"JavaRanch, where the deer and the Certified play" - David O'Meara
This tiny ad is suggesting that maybe she should go play in traffic.