• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

B & S: help in parsing database file

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic