[[TableOfContents]] == 일시 == 2014년 08월 11일 오후 1시 05분 ~ 2시 25분 == 참가자 == || 유재범 || 참석 || || 이지수 || 참석 || || 김용준 || 참석 || || 김정민 || 참석 || == 진행 상황 == * I/O === 발표(할) 내용 === * [김용준] 학우가 8/7일에 정리한 내용 보완 발표 * [한자공/시즌3/20140807] == 다음 진행 == * [이지수] 학우의 이벤트 헨들러 == 과제 == * made by [김한성] 선배님 * 미션1 : 이쁘게 GUI 구성하기 * 미션2 : 파일 입출력 사용해서 DB 관리 프로그램 만들기 * 아래의 코드는 예시코드입니다. 이를 배끼지 말고 '''참고'''해서 만들어 봅시다. * 실행은 DataBase를 펴서 실행시키셔야 합니다. * ~~계산기가 생각난다...킁...~~ * DataBase {{{ package Homework_Hansunng; import javax.swing.JFrame; //실제 파일을 관리할 곳 public class DataBase { public static void main(String[] args) { GUI mainGUI = new GUI(); mainGUI.pack(); mainGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainGUI.setVisible(true); mainGUI.setTitle("Assignment!!"); } } }}} * Data {{{ //기본적인 data형식 package Homework_Hansunng; public class Data { private String FileName; // 파일 이름은 yyyy-mm-dd형식을 사용 private String RorW; // 읽기 전용은 R 읽고 쓰기는 W (W는 기본적으로 R을 포함) private String encryption; // 암호화여부( (X xor Y) xor Y = X -> key값을 1번 xor해주면 암호화 다시 xor하면 해독) private String key = "123"; // 암호화를 위한 key값(즉 위의 식에서 Y값) private String content; // 실질적인 파일 내용 public Data(){ FileName = "2014-08-11"; RorW = "RW"; encryption = null; content = null; } public Data(String date){ FileName = date; RorW = "RW"; encryption = null; content = null; } public void setFileName(String FileName){ this.FileName = FileName; } public void setRorW(String RorW){ this.RorW = RorW; } public void setencryption(String encryption){ this.encryption = encryption; } public void setcontent(String content){ this.content = content; } public String getFileName(){ return FileName; } public String getRorW(){ return RorW; } public String getencryption(){ return encryption; } public String getcontent(){ return content; } } }}} * FileManager {{{ package Homework_Hansunng; /* File Name = yyyy-mm-dd * File Content * 1. File Name ex) 2014-08-11 * 2. Read Or Write ex) 0(It's mean that R), 1(It's mean that W) * 3. Encryption ex) 0(Not use Encryption), 1(Use Encryption) * 4. Key -> Just Key value * 5. Content -> Memo */ public class FileManager { private Data tempOfdata = new Data(); public void Save(){ } } }}} * GUI {{{ package Homework_Hansunng; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class GUI extends JFrame { private JLabel labelOfFile = new JLabel("FileName"); private JLabel labelOfRorW = new JLabel("Read or Write"); private JLabel labelOfencryption = new JLabel("PassWord"); private JLabel labelOfcontent = new JLabel("Content"); private JTextField FileName = new JTextField(10); private JTextField RorW = new JTextField(10); private JTextField encryption = new JTextField(5); private JTextField content = new JTextField(100); private JButton Save = new JButton("Save"); private JButton Load = new JButton("Load"); public GUI() { // data를 생성합시다 Data dataOftoday = new Data("2014-08-11"); // default value(First Show) dataOftoday.setRorW("R Or W을 입력하세요"); dataOftoday.setencryption("yes Or no"); dataOftoday.setcontent("저장된 내용을 불러오시려면 FileName을 입력하고 Load해주세요"); // 생성한 data를 현재 보여질 GUI에 넣어 줍시다 FileName.setText(dataOftoday.getFileName()); RorW.setText(dataOftoday.getRorW()); encryption.setText(dataOftoday.getencryption()); content.setText(dataOftoday.getcontent()); // 넣어준 요소들을 화면에 띄워줍시다 JPanel gLabel = new JPanel(); gLabel.add(labelOfFile); gLabel.add(labelOfRorW); gLabel.add(labelOfencryption); gLabel.add(labelOfcontent); gLabel.setLayout(new GridLayout(4, 1)); JPanel gText = new JPanel(); gText.add(FileName); gText.add(RorW); gText.add(encryption); gText.add(content); gText.setLayout(new GridLayout(4, 1)); JPanel topOfPanel = new JPanel(); topOfPanel.add(gLabel, BorderLayout.WEST); topOfPanel.add(gText, BorderLayout.EAST); topOfPanel.setLayout(new GridLayout(1, 2)); JPanel gButton = new JPanel(); gButton.add(Save); gButton.add(Load); gButton.setLayout(new GridLayout(1, 2)); add(topOfPanel, BorderLayout.NORTH); add(gButton, BorderLayout.SOUTH); // Save, Load Button Save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Save를 눌렀을때 돌아감 // FileManager로 잘해볼것 } }); Load.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Load를 눌렀을때 돌아감 // FileManager로 잘해볼것 } }); } } }}} === 유재범 === {{{ }}} === 이지수 === {{{ }}} === 김용준 === {{{ }}} === 김정민 === {{{ }}} == 후기 == * 막판에 과제를 주신 한성 형... 보통 우리 과제 난이도라는데 그것도 어렵더라고여 ㅋㅋㅋ - [유재범] ---- [한자공/시즌3]