• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design help with Search method for GUI

 
jesal dosa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope someone can help, this must have been asked before but i could not seem to find a search on this problem.

I have implemented the standard search and book interface, which are the only methods available to the GUI. I am really confused.
my search method is a return type of String[][] which first retrieves the records using the find method and then reads the records one at a time into the String[].

Records are referenced by there position in the database flat file. Now my question is, once i use the search method to display values in the table. when it comes to making a booking how do i reference the record it belongs to

I dont want to search for the record, before using booking, by reading fields from the record.

I was thinking about making the search function have a return type of a hash map where the record Number is a key which points to String[] containing the data, but the question still arise how does a selected row in the table know its record number.

I hope this makes since
 
jesal dosa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was thinking rather than the search method returning String [][] what if i return an Hotel Record object which contains the fields as private data members with an additional field for the recNo, then i can use this generate and populated the table.

Any suggestions would be helpful
 
jesal dosa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

After some more digging around i found the following two links which provide the answer. The answer seem to be quite simple. I can keep the String [][] and add the record no at the end of the array which i can then reference in the table model. This can then be selected and I can reference the record back to the database

Link 1

link2
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic