问题
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!
回答1:
I would look into the tutorials from Oracle:
Reading/writing text files
JTable Tutorial
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)
来源:https://stackoverflow.com/questions/11000568/reading-text-from-a-text-file-and-storing-it-in-jtable