java - Refresh code in browse button -


i working on user interface use browse button details of text files given. should display text file details on jtable , need refresh code in browse button of user interface. goes initial state of fetching data text files . using swing gui form-> jframe form. possible???

 private void btnbrowseactionperformed(java.awt.event.actionevent evt) {     jfilechooser j = new jfilechooser();     j.showopendialog(null);     file f =j.getselectedfile();     string filename = f.getabsolutepath();     txtfile.settext(filename);      //table.removeall();     try (bufferedreader br = new bufferedreader(new filereader(filename))) {         string scurrentline;         int count =1;         table = new jtable();         defaulttablemodel tablemodel = new defaulttablemodel();{          while ((scurrentline = br.readline()) != null) {             if(count==1)             {                 if(tablemodel.getcolumncount()==0)                 {                    tablemodel.setcolumnidentifiers(scurrentline.split("\\t"));                 }              }             else             {                 tablemodel.addrow(scurrentline.split("\\t"));                 //system.out.println(scurrentline);             }             count = count+1;         }     }      table.setmodel(tablemodel);      jscrollpane scrollpane = new jscrollpane();        scrollpane.setbounds(10, 42, 604, 195);        scrollpane.setviewportview(table);        panel.add(scrollpane);   


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -