I am having a problem while trying to append to a JEditorPane while using the following code:
private void appendData(String str)
{
StringBuffer bfr= new StringBuffer(str);
str ="<FONT COLOR='red' STYLE='font-size:10pt;font-family:Arial'>"+"hellooooo+</FONT><FONT STYLE='font-size:10pt;font-family:Arial'>"+str;
str+="</FONT>";//Line break
try
{
((HTMLEditorKit)foreign_area.getEditorKit()).read(new StringReader(str),foreign_area.getDocument(), foreign_area.getDocument().getLength());
foreign_area.setCaretPosition(foreign_area.getDocument().getLength());
}
catch(Exception e)
{
e.printStackTrace();
}
and i am not able to append to it. Plus that it is editable though i used the .setEditable(false) method
Can somebody help me please this is really important i need it in my project
Thank you in advance.
the code i used before this method (just in case):
JEditorPane foreign_area= new JEditorPane(); foreign_spane = new JScrollPane(foreign_area,JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); foreign_area = new JEditorPane(); foreign_area.setEditorKit(new HTMLEditorKit()); foreign_area.setEditable(false); // though i set it to uneditable it is still editable
Please help me and thank you in advance.
This post has been edited by Dogstopper: 05 May 2010 - 03:25 AM

New Topic/Question
Reply




MultiQuote




|