从文本文件中读取文本并将其存储在Jtable中 [英] Reading text from a text file and storing it in Jtable

查看:182
本文介绍了从文本文件中读取文本并将其存储在Jtable中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以从文本文件中读取并将内容存储在Jtable中?我有一个文本文件,其中包含有关某些进程的某些信息。这就像一个有列和各个值的表。是否有可能采取.txt文件的内容,并以Jtable的形式显示它?我正在使用Eclipse和Window Builder。
任何帮助将不胜感激。谢谢!

解决方案

我会看看Oracle的教程:



当你从文本文件您需要将其放入2D数组中,并使用该2D数组(以及columnNames数组)来创建新的JTable对象。 (更多细节可以在JTable教程中找到)

Is there any way to read from a text file and store the contents in a Jtable? I've got a text file that contains certain information about some processes. It's like a table that has columns and respective values. Is it possible to take the contents of the .txt file and display it in the form of Jtable? I'm using Eclipse and Window Builder. Any help would be highly appreciated. Thanks!

解决方案

I would look into the tutorials from Oracle:

When you get the data from the text file you would need to put it into a 2D Array and use that 2D array (along with the columnNames array) to create a new JTable Object. (more details are found in the JTable Tutorials)

这篇关于从文本文件中读取文本并将其存储在Jtable中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆