Hi All
As a beginner, I design a small programm using netbeans(6.1). Actually I designed one class and connected it with several JDialog ,but I find some difficulty with search engin and creating the LinkedList.(how can I connect between them )
main question : if I search fort he customername in the list how can I get all information about this customer . Please modify this code for me . It only works if I search for one word.
I really will appreciate your help !!
// action added to the jBotton
//===============================================
@Action
public int Search4Data() throws FileNotFoundException {
String CustomerName =null;
Vector dataList = new Vector();
String fileName = "d:\\Database.txt";
File fin = new File (fileName);
// get the user input
CustomerName = jTextField2.getText();
Scanner sc = new Scanner(fin);
int count=0;
while(sc.hasNext()){
if(sc.next().equals(CustomerName ))
dataList.add("The Searched word is : "+CustomerName + sc.next());
count++;
jList2.setListData(dataList);
}
return count;
}
//===============================================