public void loadDosenOnChanging(String nama) throws Exception { try { DosenDAO dao = new DosenDAOImpl(); List<Dosen> dosens = dao.getsByName(nama, (ProgramStudi) cmbProgdi.getSelectedItem().getValue()); cmbNamaDosen.getItems().clear(); for (Dosen d : dosens) { Comboitem items = new Comboitem(); items.setValue(d); items.setLabel(d.getNama()); cmbNamaDosen.appendChild(items); } } catch (Exception ex) { Messagebox.show(ex.getMessage()); } }
public void loadDosen() throws Exception { try { cmbNamaDosen.setValue(""); DosenDAO dao = new DosenDAOImpl(); List<Dosen> dosens = dao.getsByProdi((ProgramStudi) cmbProgdi.getSelectedItem().getValue()); cmbNamaDosen.getItems().clear(); for (Dosen d : dosens) { Comboitem items = new Comboitem(); items.setValue(d); items.setLabel(d.getNama()); cmbNamaDosen.appendChild(items); } } catch (Exception ex) { ex.printStackTrace(); Messagebox.show(ex.getMessage()); } }