I am currently working in Swing UI Assignment. This work involves displaying large file contents in JTextArea. File size can reach 2 GB.
My initial idea is lazy loading content from a file, say, 1 MB of content will be displayed to the user. As the user scrolls, I get the next 1 MB of content to be shown. All these operations will be performed in the background thread (Swing Worker).
I looked at the JTextArea API, inserting a method as a parameter takes String and int (insert position).
This is enough, but I'm worried about performance, because the extracted content (1 MB at a time) must be converted to a String object.
Is there any other work or any other alternative / best solution for this.
source
share