private void createData() { ForeignLanguage m = new ForeignLanguage(); m.setForeignLanguageName(txtCountryName.getText()); m.setForeignLanguageId(String.valueOf(Math.random() * 10)); m.setCountryIdActual(country.getId()); foreignLanguageBN.insert(m); resetData(); loadData(); }
private void loadData() { list = foreignLanguageBN.selectLanguageByCountryId(country.getId()); String[] header = {"Thông số"}; model = new DefaultTableModel(header, 0); for (ForeignLanguage bean : list) { String[] rows = {bean.getForeignLanguageName()}; model.addRow(rows); } tableObject.setModel(model); }
private void tabelSelectedRow() { if (tableObject.getSelectedRow() < 0) { return; } foreignLanguage = list.get(tableObject.getSelectedRow()); txtCountryName.setText(foreignLanguage.getForeignLanguageName()); btnCreate.setEnabled(false); btnDelete.setEnabled(true); btnEdit.setEnabled(true); }
private void editData() { foreignLanguage.setForeignLanguageName(txtCountryName.getText()); foreignLanguageBN.update(foreignLanguage); resetData(); loadData(); }
private void removeData() { foreignLanguageBN.delete(foreignLanguage.getId()); model.removeRow(tableObject.getSelectedRow()); resetData(); loadData(); }