private boolean SaveRow() { boolean result = false; this.CopyObjectToModel(); if (_member.MergeRow()) { DefaultTableModel tblModel = (DefaultTableModel) jTabMember.getModel(); if (_isNew) { tblModel.addRow( new Object[] { _member.getId(), _member.getNama(), _member.getAlamat(), _member.getJenisPengenal(), _member.getNoPengenal(), _member.getKontak(), skg.toString() }); cUtils.ClearObjInput( new Object[] {txtId, txtNama, txtAlamat, cmbJenis, txtPengenal, txtKontak}); } else { int rowPosition = jTabMember.convertRowIndexToModel(jTabMember.getSelectedRow()); tblModel.setValueAt(_member.getId(), rowPosition, 0); tblModel.setValueAt(_member.getNama(), rowPosition, 1); tblModel.setValueAt(_member.getAlamat(), rowPosition, 2); tblModel.setValueAt(_member.getJenisPengenal(), rowPosition, 3); tblModel.setValueAt(_member.getNoPengenal(), rowPosition, 4); tblModel.setValueAt(_member.getKontak(), rowPosition, 5); tblModel.setValueAt(skg, rowPosition, 6); } result = true; } return result; }
private void LoadRows() { mMember member = new mMember(); List CollectionOfMember = member.FetchRows(); ListIterator lst = CollectionOfMember.listIterator(); DefaultTableModel tblModel = (DefaultTableModel) jTabMember.getModel(); while (lst.hasNext()) { mMember item = (mMember) lst.next(); tblModel.addRow( new Object[] { item.getId(), item.getNama(), item.getAlamat(), item.getJenisPengenal(), item.getNoPengenal(), item.getKontak(), item.getTglDaftar() }); } }