Re: Some java help needed!
damar thapa <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Martin, Thanks for your message. I now used ArrayList, instead of Array, and is working upto storing lines into it. But, country.setListData(countryList.iterator()); part is still not working. Any other pointers? Damar Martin Paoletta wrote: >Hi, > >You need to initialize your array, probably doing something like: > >String[] countryList = new String[10]; > >But it's better to use a collection, like an ArrayList and do > >country.setListData(countryList.iterator()); > >Hope it helps, >Martin > >-----Mensaje original----- >De: [email protected] >[mailto:[email protected]] En nombre de damar thapa >Enviado el: Viernes, 09 de Mayo de 2003 02:18 p.m. >Para: [email protected] >Asunto: [Barracuda] Some java help needed! > > >Hi, > >I have the following code: > > >else if (key.equals("Country")) { > String[] countryList; > int i=0; > try{ > BufferedReader in = new BufferedReader(new >FileReader("countries.txt")); > String str=null; > > while ((str= in.readLine())!=null){ > countryList[i++]=str; > } > in.close(); > } catch (IOException e){} > > BSelect country = new BSelect(); > country.setListData(countryList); > return country; > } > >I am trying to read the list of countries from countries.txt file, put >them in countryList (array of string), and send the list as parameter of > >setListData to the instance of BSelect. > >Seems, I cann't store them in array, any pointers? > >Thanks. > >Damar > >_______________________________________________ >Barracuda mailing list >[email protected] >http://barracudamvc.org/lists/listinfo/barracuda > >_______________________________________________ >Barracuda mailing list >[email protected] >http://barracudamvc.org/lists/listinfo/barracuda > > >