i'm a newbie,
I hope there is help in the same instance
I really do not know and can not do it
I have a table
how to make sorting jtable??
private void search(){
DefaultTableModel tabModel = (DefaultTableModel) Tabel_Barang.getModel();
tabModel.setRowCount(0);
try{
strSql = "";
strSql = " SELECT kodebarang,category,merk,itembarang,type,satuan FROM masterbarang ";
stmt=koneksi.createStatement();
rslt=stmt.executeQuery(strSql);
while(rslt.next()){
String kodebarang=rslt.getString("kodebarang");
String category=rslt.getString("category");
String merks=rslt.getString("merk");
String itembarang=rslt.getString("itembarang");
String type=rslt.getString("type");
String satuan=rslt.getString("satuan");
Object[] data = {kodebarang,category,merks,itembarang,type,satuan} ;
tabModel.addRow(data);
AutofitTableColumns.autoResizeTable(Tabel_Barang, true);
}
}catch (SQLException ex) {
Logger.getLogger(contoh.class.getName()).log(Level .SEVERE, null, ex);
}
}