I'm having a difficult time trying to optimize the adding of a large file to a JTextPane. I have searched everywhere on the internet and cannot seem to find anything that looks feasible. One site mentions removing the JTextPane's document while insertions are being done to avoid any unnecessary updates. I tried this but it did not seem to help much.
What I'm thinking of doing is creating the zone model where i load a chunk of the data and listen for the user to reach the end of the scrollbar. At that point I add another chunk to the pane.
I have that functionality working fine. However, I would like to make the insertion of text much more efficient. Anyone have any tips how to speed things up?
- I grab text from file and put into a
string > mb - this is fine
- I then call pane.settext(string) -> this is where things really hang.