jtable - Changing table data -
i have table shown in app , i'd search button change data shown in table.
how ?
txsearch = new jtextfield(); txsearch.setbounds(107, 11, 150, 20); contentpane.add(txsearch); txsearch.setcolumns(10); jbutton btnsearch = new jbutton("search"); btnsearch.setbounds(261, 10, 89, 23); contentpane.add(btnsearch); thanks in advance
here's part of code :
class querytablemodel extends abstracttablemodel implements tablemodellistener{ while (rs.next()) { string[] record = new string[colcount]; (int = 0; < colcount; i++) { record[i] = rs.getstring(i + 1); } cache.addelement(record); } firetablechanged(null); // notify have new table. } } catch (exception e) { cache = new vector<string[]>(); // blank out , keep going. e.printstacktrace(); } } @override public void tablechanged(tablemodelevent e) { // todo auto-generated method stub } }
Comments
Post a Comment