wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes how to print the contents of jtextpane. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to print the contents of jtextpane." Watch "how to print the contents of jtextpane." New topic
Author

how to print the contents of jtextpane.

narasimharao konjeti
Ranch Hand

Joined: Apr 26, 2003
Posts: 130
hi all,
I have one query on JTextPane, in my program, i am using JTextPane to display the html content(html editor kit installed, some images is also there). We are able to display html code correctly on JTextPane. But when i am trying to print content in JTextPane, my print page is showing "Html" content(html code), instead of printing html display .how do i resolve this problem, if there is any please send the code.
thanks in advance.
cheers
nr konjeti


"Unwise to sweat petty stuff, wise to pet sweaty stuff."
VIJAY Yadlapati
Ranch Hand

Joined: Aug 04, 2003
Posts: 175
Try this code
....
....
textPane.setSelectionStart(0);
textPane.setSelectionEnd(textPane.getText().length());
This will select the Text in the TextPane.
Then use textPane.getSelectedText() to get the visible text, and print it.
 
wood burning stoves
 
subject: how to print the contents of jtextpane.
 
Similar Threads
Text Plain and JTextPane
Printing a JTextPane
Unicode equivalent for <br>. Any idea?
JEditor not displaying unicode ↔
Problems printing text in JTextPane