Java秋千 - 将数字的信息保存为SVG
try {
FileInputStream f = new FileInputStream("proj.bin");
ObjectInputStream o = new ObjectInputStream(f);
this.FigureList = (ArrayList<Figure>) o.readObject();
o.close();
} catch (Exception x) {
}
this.addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e) {
try {
FileOutputStream f = new FileOutputStream("proj.bin");
ObjectOutputStream o = new ObjectOutputStream(f);
o.writeObject(FigureList);
o.flush();
o.close();
} catch (Exception x) {
}
System.exit(0);
}
});
我一直在使用此代码来保存面板的信息(图形位置,颜色和这些内容),因此,每当我再次运行代码时,就会已经有东西了。可以将其保存为SVG并在其他应用程序中使用此SVG文件?我试图更改“ .bin”为“ .svg”,但这似乎并不容易。
try {
FileInputStream f = new FileInputStream("proj.bin");
ObjectInputStream o = new ObjectInputStream(f);
this.FigureList = (ArrayList<Figure>) o.readObject();
o.close();
} catch (Exception x) {
}
this.addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e) {
try {
FileOutputStream f = new FileOutputStream("proj.bin");
ObjectOutputStream o = new ObjectOutputStream(f);
o.writeObject(FigureList);
o.flush();
o.close();
} catch (Exception x) {
}
System.exit(0);
}
});
I've been using this code to save the infos of my panel(Figure position, color and those kind of things), so whenever I run the code again, there will be things already there. Can save it as SVG and use this svg file in others apps? I've tried to change ".bin" for ".svg" but it seems it's not that easy.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论