Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating JTable from a textfile

 
neo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have some questions. Which are,
1. I am going to read from a text file, one line at time,(may be may not be) and store the content in a Vector. Then a part of the line(not the whole line)
1.1 Separated by a specified delimeter
1.2 Not Seperated by a specified delimeter
will be shown in each JTable cell.
I have tried this,but the whole line is coming in a single cell. How to avoid this ?
And how to fetch the data for each cell, from the text line when there is no specified delimeter(In this case, "space/Tab" is the delimeter). In JTable I have used DefaultTableModel(each row is vector of Vectors)

2.Is it fine to use DefaultTableModel as my JTable model, for the type of operation that I am going to perform ? If yes, how if no Why ?

Hope to get help from you.
Please explain with example code

Thanking you
neo
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Please explain with example code

first explain the problem with actual code

it takes a lot less time to add a line (or fix a line) to posted code
than it does to build a gui to 'requirements'
 
Paul Clapham
Sheriff
Posts: 21316
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"neojava java", welcome to JavaRanch.

We're friendly people here, but we do require members to have valid display names.

Display names must contain your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names will be deleted.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4020
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"neo"

Your name still does not conform to our naming policy. Please correct it right away. This is your second warning.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic