Hi Guys,
Right i am creating a program which is design to load up large text files in a jtextarea and allow the user to read through it and run a search, however it crashes my program when i open anything larger than 30mb file and even then the program is slow and unresponsive . Below is some of the code i am using
private void btnOpenFileActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: JFileChooser chooser= new JFileChooser(); chooser.showOpenDialog(this); File file= chooser.getSelectedFile(); filePath=file.getAbsolutePath(); LoadFile loading= new LoadFile(); loading.setFile(file); loading.start(); } class LoadFile extends Thread { // This method is called when the thread runs File file; public void run() { FileReader input; try { txtStatus.setText("Loading......"); input = new FileReader(file); txtPane.read(input, null); txtStatus.setText("Done.."); } catch (Exception ex) { } } public void setFile(File myFile){ file=myFile; } }
I have noticed a nice program called "large file viewer" it opens up these large files very quickly no laggyness or chunkiness of the interface and it works like a charm.
Do you know how i can achieve the same thing in java like opening up these large files quickly and not locking up ect ect.
Large Text File Viewer 5.2 - Features