Java秋千 - 将数字的信息保存为SVG

发布于 2025-01-29 21:48:50 字数 1203 浏览 2 评论 0原文

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.

You can see my whole code here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文