dcsimg
get ID and display details in jlable
0 posts in topic
Thread View Thread View
TOPIC ACTIONS:
 

get ID and display details in jlable...
sajjad123
Mon Dec 24, 2012 10:56 AM

i want to get ID number and display details.

when i use scanner class for get id number,and consol window for display detalis, all things is good and perfect. but when i use a jtextfield for get id and a jlable for display detail information, program find just last record in file and not find other records.
  my code is here
int idS=Integer.parsInt(JTextfield1.getText()); 
    File f=new File("C:\\SearchFile.txt");  
   FileReader fr=new FileReader(f);  
   BufferedReader br=new BufferedReader(fr);
     String s; 
     while((s=br.readLine())!=null){  
       String[] st=s.split(" ");   
      String id=st[0];     
    String name=st[1];  
       String mark=st[2];  
        if(id.trim().equalIgnorecase(String.valueOf(idS))){   
           JLable1.setText(id+" "+name+ " "+mark);   
      }     }

please help!

About | Sitemap | Contact