Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Append to JEditorPane

843805Dec 6 2005 — edited Dec 8 2005
As I know JEditorPane doesn't have option of append like JTextArea.
So I wrote this code:

/*--------------------------------------------------------------------------------*/
JEditorPane jp = getJep();

String str = "";

StringBuffer buff=new StringBuffer();

// FileReader -Class reading from file by using
// FileReader and BufferedReader
MyFileReader fi = new MyFileReader(getPass());
if (fi == null)
return;


while ((str = fi.Read()) != null)
{

buff.append(str+Util.getEOL());


}

jp.setText(buff.toString());
fi.CloseFile();
/*--------------------------------------------------------------------------------*/
But hte problem is it working very slowly with large files
How can I improve the speed of the code?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 5 2006
Added on Dec 6 2005
6 comments
332 views