beckham123
10
2020-05-22 21:43:59
0
97

저 GUI응용 질문점요


지금GUI TextArea에 스트림으로 저장한것을 출력하려하는데 캐스팅에러가나서 해결을 못하겠네여


saveButton.addMouseListener(new MouseAdapter() {

@Override

public void mouseClicked(MouseEvent e) {

if(!textArea.equals(null)) {

Board board = new Board(textArea.getText().toString());

try {

ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("게시글.txt"));

oos.writeObject(board);

} catch (FileNotFoundException ex) {

ex.printStackTrace();

} catch (IOException ex) {

ex.printStackTrace();


}

try {

ObjectInputStream ois = new ObjectInputStream(new FileInputStream("게시글.txt"));

try {

viewArea.setText((String)ois.readObject()); // 캐스팅 에러발생

} catch (ClassNotFoundException e1) {

e1.printStackTrace();

}

}  catch (IOException ex) {

}

}

}

});

0
0
  • 답변 0

  • 로그인을 하시면 답변을 등록할 수 있습니다.