gpt4 book ai didi

java - 如何在 Java 类应用程序中添加另存为对话框

转载 作者:行者123 更新时间:2023-12-02 05:55:55 33 4
gpt4 key购买 nike

我有一个 pdf 生成代码,需要使用“另存为”对话框进行保存,但我不知道如何在 java 类应用程序中执行此操作。这是我的代码..

PdfWriter writer = null;

Document document = new Document();

try {
writer = PdfWriter.getInstance(document, new FileOutputStream(
fileName));

document.open();

请建议我如何添加“另存为对话框”。

最佳答案

尝试 JFileChooser:http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

然后使用路径和文件名保存在后端函数中。

关于java - 如何在 Java 类应用程序中添加另存为对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23085572/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com