1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | package com.hanbit.oop.controller; import javax.swing.JOptionPane; import com.hanbit.oop.domain.MemberBean; import com.hanbit.oop.service.AdminService; import com.hanbit.oop.serviceImpl.AdminServiceImpl; public class AdminController { public static void main(String[] args) { String sCount=JOptionPane.showInputDialog("관리자님 총회원수를 입력해주세요"); int count=Integer.parseInt(sCount); AdminService service=new AdminServiceImpl(count); MemberBean member=null; String sList=""; while(true){ switch (JOptionPane.showInputDialog("0.exit 1.add 2.count 3.list 4.findById 5.findByName 6.update")) { case "0":return; case "1": member=new MemberBean(); String[] arr=JOptionPane.showInputDialog("NAME/ID/PASS/SSN").split("/"); member.setName(arr[0]); member.setId(arr[1]); member.setPw(arr[2]); member.setSsn(arr[3]); service.addMember(member); JOptionPane.showMessageDialog(null, "회원가입 성공"); break; case "2": JOptionPane.showMessageDialog(null, service.countMembers()); break; case "3": MemberBean[] list=service.getMembers(); JOptionPane.showMessageDialog(null, "1번째"+list[0]); JOptionPane.showMessageDialog(null, "2번째"+list[1]); JOptionPane.showMessageDialog(null, "3번째"+list[2]); for(int i=0;i<list.length;i++){ sList+=list[i].toString()+"\n"; } JOptionPane.showMessageDialog(null, "리스트"+sList); break; case "4": JOptionPane.showMessageDialog(null, service.findById( JOptionPane .showInputDialog("검색 아이디 입력: ")).toString()); break; case "5": String name=JOptionPane.showInputDialog("조회할 이름을 입력하세요"); MemberBean[] members=service.findByName(name); String result=""; if(members.length==0){ result="조회할 이름이 없습니다."; }else{ for(int i=0;i<members.length;i++){ result+=members[i].toString()+"\n"; } } JOptionPane.showMessageDialog(null,result); break; default: break; } } } } | cs |
'Java' 카테고리의 다른 글
19. 회원관리 Swing 앱 :: AdminServiceImpl.java (0) | 2020.04.30 |
---|---|
[자바 Swing] Calculator.java (0) | 2020.04.30 |
19. 회원관리 Swing 앱 :: EmployeeUI.java (0) | 2020.04.30 |
[자바 Swing] 로또 LottoMain.java LottoUI.java Lotto.java (0) | 2020.04.30 |
[자바 객체지향] 인터페이스 활용한 가위바위보 게임 Rps.java (0) | 2020.04.30 |