public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); System.out.print("사번:"); int empno = scan.nextInt(); EmpDAO dao = new EmpDAO(); EmpDTO d = dao.empDetail(empno); System.out.println("사번:" + d.getEmpno()); System.out.println("이름:" + d.getEname()); System.out.println("직위:" + d.getJob()); System.out.println("사수:" + d.getMgr()); System.out.println("입사일:" + d.getHiredate()); System.out.println("급여:" + d.getSal()); System.out.println("성과급:" + d.getComm()); System.out.println("부서번호:" + d.getDeptno()); }
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); } }
@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); } } }