This content has been marked as final. Show 3 replies
I did a few performance test.
I commented out the extra linebreaks and timed how long it took before the text appearded on the screen
100K - 004 seconds
200K - 023 seconds
300K - 405 seconds
So it not surprising that with 1 MB you will wait forever.
As said, there is no problem when last line is not a long line.
Would you realistically want such a huge String displayed in a GUI? Why? Why not display part of it, then fetch more as needed. Isn't that what most real-world programs would do? This doesn't seem to be a realistic problem to me; maybe I'm missing something.
I have a built an editor for plain text and xml and then it this is a very realistic scenario (300K is not that big and you may expext form a textcomponent that it will be handled correctly).
Would you realistically want such a huge String displayed in a GUI
And in fact, when the long line is not the last one, there is no problem and one can load much larger content.
Yes this really make sense but I was hoping that the java textcomponents would do this. Because else, you have to code a lot by yourself.
Why not display part of it, then fetch more as needed.
It looks like this is really a code prolem in some gui class. And my feeling is that it can solved. Maybe by "fooling" the calculation with the extra lineberak at the end and then correct it just for displaying. Any suggetion, workaround is very welcome.