File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes help,how to improve JTextPane's efficiency? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "help,how to improve JTextPane Watch "help,how to improve JTextPane New topic
Author

help,how to improve JTextPane's efficiency?

zhijie dong
Greenhorn

Joined: Mar 28, 2005
Posts: 1
such as:

if there have 20 thousand rows,how to do?



StyledDocument doc=new StyledDocument();
JTextPane textPane=new JTextPane(doc);

Style errorStyle=textpane.addStyle(null,null);
StyleConstants.setForeground(defaultStyle,Color.RED);

Style infoStyle=textpane.addStyle(null,null);
StyleConstants.setForeground(infoStyle,Color.BLUE);

int count=1;
while(true){
doc.insertString(doc.getLength(), ""+count, errorStyle);
doc.insertString(doc.getLength(), ""+count, infoStyle);
count++;
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help,how to improve JTextPane's efficiency?