JEditorPane problem cannot append (code provided)

i am having problems while trying to append to a JEditorPane

Page 1 of 1

1 Replies - 1491 Views - Last Post: 05 May 2010 - 10:24 AM Rate Topic: -----

#1 JAVADDICT  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 10-September 09

JEditorPane problem cannot append (code provided)

Posted 04 May 2010 - 11:22 PM

Hello,
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


Is This A Good Question/Topic? 0
  • +

Replies To: JEditorPane problem cannot append (code provided)

#2 JAVADDICT  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 10-September 09

Re: JEditorPane problem cannot append (code provided)

Posted 05 May 2010 - 10:24 AM

View PostJAVADDICT, on 04 May 2010 - 10:22 PM, said:

Hello,
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.


i figured out the problem . I was recreating the object another time. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1