@Override public void valueChanged(ListSelectionEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body // of generated methods, choose Tools | Templates. try { if (e.getValueIsAdjusting()) { return; } ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { } else { int lead = lsm.getLeadSelectionIndex(); view.setDepartmentInfo(displayRowValues(lead)); view.setBtnEditEnable(true); view.setBtnDeleteEnable(true); view.setBtnAddEnable(false); } } catch (Exception se) { JOptionPane.showMessageDialog( departmentView, se + "from ListSelectionListener " + getClass().getName()); } }