The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
March 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

may this will help?

Posted by mie on August 15, 2001 at 8:22 AM

public void createdefaulthtmldoc(){

//he.htmlkit, HTMLEditorKit
//he.jep, JEditorPane

he.htmlkit = new HTMLEditorKit();
he.htmldoc = (HTMLDocument)he.htmlkit.createDefaultDocument();
//he.htmldoc.setBase(he.hv.htmldoc.getBase());

/* install HTMLEditor kit to JEditorPane, it will serialize the
contentType */
he.jep.setEditorKit(he.htmlkit);
he.jep.setDocument(he.htmldoc);

}

protected void insertHTML(String tag[],String seltext){

try{
StringReader rmsg = new StringReader(tag[0] + seltext + tag[1]);
htmlkit.read(rmsg,htmldoc,p);

}
catch(BadLocationException _b){ System.out.println(_b.getMessage()); }
catch(IOException _io){ System.out.println(_io.getMessage()); }
catch(NullPointerException _n){ System.out.println(_n.getMessage()); }

} // modifytext()






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us