繁体   English   中英

如何在不使用JFileChooser的情况下读取JTextArea中的文件(.txt)?

[英]how to read a file (.txt) in a JTextArea without using JFileChooser?

我想知道如何在不使用JFileChooser情况下读取JTextArea的文件( .txt )吗? 我想知道是否还有其他方法可以在程序主体上编写代码以在JTextArea`` without using上显示它JTextArea`` without using JFileChooser`?

BufferedReader in = new BufferedReader(new FileReader("<Filename>"));
String line;
while((line = in.readLine()) != null)
{
     txtArea.append(line);
}
in.close(

);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM