티스토리 뷰
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 |
'1. 자바' 카테고리의 다른 글
service-array Admin (0) | 2020.05.24 |
---|---|
main-swing Calculator (0) | 2020.05.24 |
main-swing Employee (0) | 2020.05.24 |
main-swing-vo Lotto (0) | 2020.05.24 |
Fwd: 디자인패턴 종류 블로그 참조 (0) | 2020.05.24 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Django
- vscode
- nodejs
- tensorflow
- mariadb
- springMVC
- Git
- JPA
- JUnit
- Java
- Mongo
- intellij
- Algorithm
- database
- KAFKA
- docker
- maven
- jQuery
- COLAB
- SpringBoot
- Mlearn
- SQLAlchemy
- FLASK
- ERD
- Eclipse
- AWS
- terms
- Oracle
- React
- Python
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함