How do we save the modifications made to a HTML file using JEditorPane?

Sandip Chitale


// Say - editorPane is your JEditorPane
try {
  FileWriter writer = new FileWriter("file.html");
  EditorKit kit = editorPane.getEditorKit();

  kit.write(writer
            ,editorPane.getDocument()
            ,0
            ,editorPane.getDocument().getLength());

} catch (Exception e) { //use better exception catching here
  System.err.println(e);
}
  



0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact