I would like to know how I read a file ( .txt ) in a JTextArea
without using JFileChooser
? I would like to know if there is any other way to write the code on the body of program to display it on JTextArea`` without using
JFileChooser`?
BufferedReader in = new BufferedReader(new FileReader("<Filename>"));
String line;
while((line = in.readLine()) != null)
{
txtArea.append(line);
}
in.close(
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.