private class MyActionListener implements ActionListener {
public void actionPerformed(ActionEvent e){
if( e.getActionCommand()== "Open"){
JFileChooser chooser = new JFileChooser();
int ret = chooser.showOpenDialog(null);
if(ret == JFileChooser.APPROVE_OPTION){
String pathName = chooser.getSelectedFile().getPath();
System.out.println(pathName);
FileReader in = null;
try{
in = new FileReader(pathName);
int c;
while ((c = in.read()) != -1) {
System.out.print((char)c);
jta.append((char)c+"");
}
in.close();
}catch (IOException e1){
System.out.println("입출력 오류");
}
}
}
if(e.getActionCommand() == "New"){
jta.setText("");
}
if(e.getActionCommand() == "Save as"){
System.out.println("Save as");
JFileChooser chooser = new JFileChooser();
int ret = chooser.showSaveDialog(null);
if(ret == JFileChooser.APPROVE_OPTION){
}
}
if(e.getActionCommand() == "About Memo"){
}
}
}
여기서 save as 창까진 뜨는데 저장하는게 어떤 코드를 넣어야될지 모르겠어요ㅠㅠ
어떤 코드를 넣어야 저장이 되나요?
댓글 0