File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTextPane "text/html"

 
selvas kumars
Ranch Hand
Posts: 115
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic