After much internal debate, I decided to implement my UI to search for names and locations using combo boxes. My problem is how to expose these names and locations to the UI, so that these combo boxes are populated.
My Data class implements the DBMain interface. It contains a reference to SubcontractorFileAccess.java, which does the actual file reading using RandomAccessFile.
Now since SubcontractorFileAccess will be responsible for retrieving a collection of names and locations, how are these values made available to the client, without accessing SubcontractorFileAccess directly? The only way the Data class is accessed is through the DBMain interface, and according to the assignment specification I am not permitted to add new methods to the DBMain interface to get names and locations from the Data layer. I was going to add public methods to the Data class, but I would need a reference to the Data class implementation to access these methods. It is undesirable because my Data class is screaming for it to be accessed via the DBMain interface.
Does anyone have any ideas on how I can retrieve name and location from the Data layer?
When retrieving all record from your database I guess you want to display them in a JTable component. Maybe you can use a Map for the locations and names. Maps do not allow duplicate values. Use the Map to display the unique values in your combo box for location and name
by the way : I passed the exam wit 373/400. I use Jtextfields for my search values.