<div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;">static boolean modifyInfo(UserTableModel tableModel) // 학생 정보 수정</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>{</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>student.name =(String)tableModel.getValueAt(0, 1);</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>//학번 은 변경 불가, 학과는 소프트웨어 학과로 고정</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>student.grade =(String)tableModel.getValueAt(3,1);</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>student.birthDay =(String)tableModel.getValueAt(4, 1);</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>student.state =(String)tableModel.getValueAt(5, 1);</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>student.admissionYear =(String)tableModel.getValueAt(6, 1);</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>student.address =(String)tableModel.getValueAt(7, 1);</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>student.phoneNum =(String)tableModel.getValueAt(8, 1);</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span></div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>File fp = new File("StudentList.txt"); </div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>FileReader fileR;</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>try {</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>fileR = new FileReader(fp);</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>BufferedReader reader = new BufferedReader(fileR);</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>BufferedWriter writer = new BufferedWriter(new FileWriter(fp));</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>String line = null;</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>String[] Split;</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>while ((line = reader.readLine()) != null) {</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>Split = line.split("<span class="Apple-tab-span" style="white-space:pre;"> </span>"); </div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>if(Split[0].equals(student.studentNum))</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>{</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>// 이부분을 어떻게 채워 넣을까요?</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span></div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>return true;</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>}</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>System.out.println();</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>}</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>reader.close();</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>} catch (FileNotFoundException e) {</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>System.out.println("파일을 찾을 수 없습니다.");</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>e.printStackTrace();</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>} catch (IOException e) {</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>e.printStackTrace();</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>}</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>return false;</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span></div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>}</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><br></div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;">제가 짜고 있는 코드 일부분인데요 지금 종합정보 시스템을 짜고 있는데 데이터 베이쓰는 따로 안쓰고 메모장으로 파일 입출력을 통해 하는 중 입니다.<br>질문 드리고 싶은 부분은 메모장에서 학생 정보를 읽고 수정한 뒤 다시 메모장에 덮어 쓰려고 하는데 변경 하고 싶은 부분만 읽어서 덮어 쓰기 하니까 메모장이 통째로 자꾸 지워집니다. 어떻게 하면 좋을지 몰라서 질문 드립니다. </div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"><br></div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;">참고로 학생 정보가 담긴 메모장 내용은 이렇습니다.</div> <div style="font-family:gulim, Dotum, Helvetica, AppleGothic, sans-serif;line-height:19.6363639831543px;"> <div>11111111<span class="Apple-tab-span" style="white-space:pre;"> </span>7136<span class="Apple-tab-span" style="white-space:pre;"> </span>송민수<span class="Apple-tab-span" style="white-space:pre;"> </span>4<span class="Apple-tab-span" style="white-space:pre;"> </span>d우리집<span class="Apple-tab-span" style="white-space:pre;"> </span>999999999<span class="Apple-tab-span" style="white-space:pre;"> </span>901021<span class="Apple-tab-span" style="white-space:pre;"> </span>0903<span class="Apple-tab-span" style="white-space:pre;"> </span>재학</div> <div>22222222<span class="Apple-tab-span" style="white-space:pre;"> </span>2134<span class="Apple-tab-span" style="white-space:pre;"> </span>권주혁<span class="Apple-tab-span" style="white-space:pre;"> </span>4<span class="Apple-tab-span" style="white-space:pre;"> </span>서울특별시 종로구 청와대로 1청와대<span class="Apple-tab-span" style="white-space:pre;"> </span>01011112222<span class="Apple-tab-span" style="white-space:pre;"> </span>911123<span class="Apple-tab-span" style="white-space:pre;"> </span>1003<span class="Apple-tab-span" style="white-space:pre;"> </span>휴학</div></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.