3차최종
닫기
  • 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
해당 자료는 10페이지 까지만 미리보기를 제공합니다.
10페이지 이후부터 다운로드 후 확인할 수 있습니다.

본문내용

);
miExit.addActionListener(handler);
setSize(300, 200); //실행시 가로 300,세로 200크기의 초기화
setVisible(true); //전체 Frame을 볼수 있도록 함
}
// 선택된 파일의 내용을 읽어서 TextArea에 보여주는 메서드
void fileOpen(String fileName) {
FileReader fr;
BufferedReader br;
StringWriter sw;
try {
fr = new FileReader(fileName); //fileName을 읽어옴 fr에 저장
br= new BufferedReader(fr); //fr의 내용을 읽어서 br에 저장
sw = new StringWriter(); //메모장에 쓰기 위한 sw
int ch = 0;
while ((ch=br.read())!=-1) {
sw.write(ch); //읽어올 내용이 있을때 그내용을 메모장에 씀
}
br.close();
content.setText(sw.toString());
//content(쓰기화면)에 sw객체의 내용을 써서 보여줌
} catch(IOException e) {
e.printStackTrace(); //에러메세지의 근원을 찾아서 단계별로 출력
}
} // fileOpen메서드의 끝
// TextArea의 내용을 지정된 파일에 저장하는 메서드
void saveAs(String fileName) {
FileWriter fw;
BufferedWriter bw;
try {
fw = new FileWriter(fileName);
bw= new BufferedWriter(fw);
bw.write(content.getText()); //TextArea의 내용을 파일에 저장
bw.close();
} catch (IOException ie) {
ie.printStackTrace();
} // try
} // saveAs메서드의 끝
// 메뉴를 클릭했을 때 메뉴별 처리코드
class MyHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand(); //버튼 클릭시
if(command.equals("New")) { //버튼이 new버튼이면
content.setText(""); //TextArea의 내용을 아무것도 없게함
} else if(command.equals("Open")) { //버튼이 open이면
FileDialog fileOpen = new FileDialog(TextEditor.this, "파일열기");
fileOpen.setVisible(true);
fileName = fileOpen.getDirectory() + fileOpen.getFile();//경로저장
System.out.println(fileName);
// 선택된 파일의 내용을 TextArea에 보여준다.
fileOpen(fileName); //, content);
} else if(command.equals("Save As...")) {
FileDialog fileSave = new FileDialog(TextEditor.this,"파일저장",FileDialog.SAVE); //파일저장 다이얼 로그 출력을 위한 fileSave선언
fileSave.setVisible(true); fileSave 다이얼로그 화면 출력
fileName = fileSave.getDirectory() + fileSave.getFile(); //경로
System.out.println(fileName);
// 현재 TextArea의 내용을 선택된 파일에 저장한다.
saveAs(fileName);
} else if(command.equals("Exit")) {
System.exit(0); // 프로그램을 종료시킨다.
}
}
} // class MyHandler
} // TextEditor클래스의 끝
<소스코드>
<실행화면>

모델과 관련된 클래스들은 크게 2가지 종류로 구분할 수 있다. 하나는 데이터를 저장하는 부분이고 다른 하나는 기능을 수행하는 부분이다. 따라서 모델을 구현하는 작업은 데이터를 표한하는 클래스를 작성하고 그 클래스를 사용하여 비즈니스 요구 사항을 처리해주는 클래스를 작성하는 과정이라 할 수 있다.

TextEditor 와 MyHandler 객체를 통해 필요한 정보를 view 페이지 에서는 그 정보를 이용하여 클라이언트 화면에 뿌려줄 화면을 구성한다.
8. 참고문헌
[1] 두산백과사전 EnCyber &EnCyber.com
[2] 김은옥, “JSP 2.0 웹 프로그래밍”, 삼양미디어, 2007
정희철 싸이월드 블로그, http://www.cyworld.com/i2b_jhc/3573275
[3] Whatis.com Inc., http://www.terms.co.kr/architecture.htm
[4]「Model-View-Controller」,『J2EE Patterns』,2010.03.29,
http://java.sun.com/blueprints/patterns/MVC-detailed.html
[5] 이성몽 네이버 블로그,
http://blog.naver.com/santalsm?Redirect=Log&logNo=110035101190
[6]「Model-View-Controller」,『J2EE Patterns』,2010.03.29,
http://java.sun.com/blueprints/patterns/MVC-detailed.html
[7] 최범균, “MVC 프레임워크로 구현한 JSP 실전 Know-How", 가메출판사, 2003
[8] "MVC Pattern, javascript Opener, ",
http://kkhhss1012.springnote.com/pages/4444289
[9] 김형준, 2003, “JSP Model2(MVC 패턴)를 이용한 웹사이트 구축”.
  • 가격4,000
  • 페이지수44페이지
  • 등록일2012.04.18
  • 저작시기2010.12
  • 파일형식한글(hwp)
  • 자료번호#740977
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니