Skip to content
Advertisement

Loading a text file into a textarea

First of all, I am very basic at java. I am trying to browse a .txt file and load the contents of it, into the text area. I am completed the part, till which I receive the file from the JFileChooser, now I dont know how to do the remaining.

JavaScript

Advertisement

Answer

Use the read(…) and write(…) methods that are suppoorted by all Swing text components. Simple example:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement