• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B & S: help in parsing database file

 
Paul O'Leary
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having tried searching this forum for ideas which I must say is an excellent resource for other problems I have encountered so far, I am still unfortunately stuck trying to figure out how to parse the database file correctly to String arrays in order to display within a JTable in my GUI ie. how do I group the appropriate columns with their corresponding values?

I understand that the recommended way is to use a RandomAccessFile class to be used in conjunction with the DBAccess interface implementation so to enable any record to be accessed for searching, but initially all I want to be able to do is display all the records in the JTable.

Any hints, tips or examples would be most appreciated.
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul O'Leary:
Having tried searching this forum for ideas which I must say is an excellent resource for other problems I have encountered so far, I am still unfortunately stuck trying to figure out how to parse the database file correctly to String arrays in order to display within a JTable in my GUI ie. how do I group the appropriate columns with their corresponding values?

I understand that the recommended way is to use a RandomAccessFile class to be used in conjunction with the DBAccess interface implementation so to enable any record to be accessed for searching, but initially all I want to be able to do is display all the records in the JTable.

Any hints, tips or examples would be most appreciated.


It would probably be best to at least get the read methods in the data class working, so you can use it go obtain all the records from the database and get a feel for the record structure, file format etc..

Once you can read all the records from the file, for simple display purposes your best bet is to use a DefaultTableModel instance.

Construct a String[][] array containing all the records read from the file (an array of record String[]'s). The constructor you would use is .

Then pass this table model instace to your JTable constructor to display in the table.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic