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

Problem in loading Flight list on combo box

 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am unable to load flight number list on combobox, please tell me the procedure how to load the list in combobox.
My efforts are I had created a getRecords() method in my data class which returns an string array of flight records as follows:
public String[] getRecords()throws IOException{
String [] values=readRecord();
return values;
}
and in my client GUI i am accessing this method with the help of remote interface
eg:
private void loadList(){
try{
recCount=intf.getRecordCount();
for(int i=1; i<=recCount; i++){
String val[]=intf.getRecords();
vec.add(val[0]);
}
}catch(Exception ex){
ex.printStackTrace();
}
}
The client list is loaded sucessfully in one client but when another client application invokes it does'nt load list on second client. Plz tell me the solution how i have to proceed to get the accurate results
Anurag Mishra
 
Mathew Sam
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anurag,
There is some logical error in your code.The readRecord() method in your Data class read one reord from the current location of the file pointer.By the time it read records for the first client the file poinetr reaches end of file.So for next clients it won't return any records
 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mathew Sam
So what will be the correct way to load list to my combobox. Plz send me some discriptive solution regarding this problem, i will be really thankful to you.
Anurag Mishra
 
Mathew Sam
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
call the getRecord method in the Data class in a for loop.
 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sam
This is exactly that I want.
Anurag Mishra
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic