package onj;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
class AWTSerTest extends Frame {
TextArea view = new TextArea();
public AWTSerTest() {
add(view, "Center");
}
public static void main(String[] args) {
Frame f = null;
try {
FileInputStream inFile = new FileInputStream("AWTSerTest.ser");
ObjectInput in = new ObjectInputStream(inFile);
f = (Frame) in.readObject();
} catch (IOException ioe) {
f = new AWTSerTest();
f.setSize(500, 300);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
try {
FileOutputStream outFile = new FileOutputStream(
"AWTSerTest.ser");
ObjectOutput out = new ObjectOutputStream(outFile);
out.writeObject(we.getWindow());
out.close();
System.exit(0);
} catch (IOException e) {
e.printStackTrace();
}
}
});
f.setVisible(true);
}
}
댓글 없음:
댓글 쓰기