@Override public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub if (e.getSource() == table) { if (e.getClickCount() == 2) { int row = table.getSelectedRow(); String sabun = model.getValueAt(row, 0).toString(); EmpDAO dao = new EmpDAO(); EmpDTO d = dao.empDetailData(Integer.parseInt(sabun)); String msg = "사번:" + d.getEmpno() + "\n" + "이름:" + d.getEname() + "\n" + "직위:" + d.getJob() + "\n" + "사수번호:" + d.getMgr() + "\n" + "입사일:" + d.getHiredate().toString() + "\n" + "급여:" + d.getSal() + "\n" + "성과급:" + d.getComm() + "\n" + "부서번호:" + d.getDeptno(); JOptionPane.showMessageDialog(this, msg); } } }
public void getFindData(String column, String fdata) { for (int i = model.getRowCount() - 1; i >= 0; i--) { model.removeRow(i); } EmpDAO dao = new EmpDAO(); ArrayList<EmpDTO> list = dao.empFindData(column, fdata); for (EmpDTO d : list) { String[] data = { String.valueOf(d.getEmpno()), d.getEname(), d.getJob(), d.getHiredate().toString(), String.valueOf(d.getDeptno()) }; model.addRow(data); } }