简体   繁体   English

如何读取文本文件并将其在netbeans JTextArea中显示?

[英]How can i read a text file and diplay it in a netbeans JTextArea?

I'm working in a Netbeans GUI project. 我正在从事Netbeans GUI项目。 All I want to do is to read a text file from a path and display it in a JTextArea using Netbeans. 我要做的就是从路径读取文本文件,并使用Netbeans在JTextArea显示它。 How can I achieve this? 我该如何实现?

Is there any simple way to do this just using the file path? 有没有简单的方法可以仅使用文件路径来执行此操作?

Lets say i want this be done after a button click.. 可以说我希望在单击按钮后完成此操作。

请参阅JTextComponent.read(Reader,Object)以获取几乎一个“单行解决方案”。

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

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