import java.beans.XMLEncoder;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import javax.swing.JFrame;
public class MainClass {
public static void main(String args[]) {
JFrame x = new JFrame("Look at me");
x.setSize(200, 300);
x.setVisible(true);
x.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
FileOutputStream f;
try {
f = new FileOutputStream("Test.xml");
XMLEncoder e = new XMLEncoder(new BufferedOutputStream(f));
e.writeObject(x);
e.close();
} catch (Exception e) {
}
}
}
|