java - Appending a String to a JTextPane -


i have question. appending string in jtextpane, chatwindow, insertstring, issue don't know how 'insertstring' jtextpane. here code:

private void showmessage(final string string){             swingutilities.invokelater(                 new runnable(){                     public void run(){                         //chatwindow.append(string);                         //the bottom method used appending string jtextpane style                         try                         {                             //doc.insertstring(0, "start of text\n", null );                             //doc.insertstring(doc.getlength(), "", string );                             //doc.insertstring(int offset, string str, arributeset a);                              //setting style string (down below)                              styleconstants.setforeground(keyword, color.gethsbcolor(251, 89, 87));                             //styleconstants.setbackground(keyword, color.yellow);                             styleconstants.setbold(keyword, false);                              doc.insertstring(0, string, keyword);                         }                         catch(exception e) { system.out.println(e); }                     }                 }             );         } 

where says:

doc.insertstring(0, string, keyword); 

this appending string chatwindow. issue don't know how 'insertstring' chatwindow how did in note above try-catch method:

chatwindow.append(string) 

does know use 'doc.insertstring(0, string, keyword);' insert string keyword chatwindow? result of doc.insertstring doesn't show on chatwindow. thanks.

what this?

chatwindow.getdocument().insertstring(0, string, keyword);  

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -