aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTextPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextPane "text/html"" Watch "JTextPane "text/html"" New topic
Author

JTextPane "text/html"

selvas kumars
Ranch Hand

Joined: Jan 06, 2001
Posts: 115
Hi,
If i set textPane.setContentType("text/html"), textpane shows as a html editor.But when i call a getText() it gives
an html document in a string format.I want only the text(with out html tags)??How to acheive this??
Thanks & Regards,
silva.
kshitij raval
Greenhorn

Joined: Oct 20, 2001
Posts: 15
Silva,
Well I could not find any solution to this from the API. But I have thought of a solution, let me know if this turns out to be helpful to you. Also let me know if you have found a solution already.
I have added KeyListener to JTextPane then in the keyTyped() method I added the characters typed to a String object. Whenever I wanted just the typed matter, I would refer to that String object.
String typedMatter="";
JTextPane jtp = new JTextPane();
:
:
jtp.addKeyListener(this);
:
:
public void keyTyped(KeyEvent ke){
typedMatter += ke.getKeyChar();
}
Regards,
Kshitij Raval.

[This message has been edited by kshitij raval (edited October 20, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTextPane "text/html"