当前位置: 首页>>代码示例>>Java>>正文


Java FileChooserBuilder.showSaveDialog方法代码示例

本文整理汇总了Java中org.openide.filesystems.FileChooserBuilder.showSaveDialog方法的典型用法代码示例。如果您正苦于以下问题:Java FileChooserBuilder.showSaveDialog方法的具体用法?Java FileChooserBuilder.showSaveDialog怎么用?Java FileChooserBuilder.showSaveDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.filesystems.FileChooserBuilder的用法示例。


在下文中一共展示了FileChooserBuilder.showSaveDialog方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
@Override
@NbBundle.Messages("DLG_SaveToFile=Save to File")
public void actionPerformed(ActionEvent e) {
    // Save
    FileChooserBuilder fchb = new FileChooserBuilder(BigStringCustomEditor.class);
    fchb.setTitle(Bundle.DLG_SaveToFile());
    final File f = fchb.showSaveDialog();
    if (f != null) {
        new RequestProcessor(BigStringCustomEditor.class).post(new Runnable() {
            @Override
            public void run() {
                save(f);
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BigStringCustomEditor.java

示例2: save

import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
@Override
public void save() throws IOException {
    FileChooserBuilder fchb = new FileChooserBuilder(ScreenshotComponent.class);
    String[] writerFileSuffixes = ImageIO.getWriterFileSuffixes();
    fchb.setFileFilter(new FileNameExtensionFilter(Bundle.CTL_ImageFiles(), writerFileSuffixes));
    File file = fchb.showSaveDialog();
    if (file != null) {
        if (file.exists()) {
            NotifyDescriptor nd = new NotifyDescriptor.Confirmation(Bundle.MSG_Overwrite(file.getName()), toString());
            Object doOverwrite = DialogDisplayer.getDefault().notify(nd);
            if (!NotifyDescriptor.YES_OPTION.equals(doOverwrite)) {
                return ;
            }
        }
        canvas.save(file);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ScreenshotComponent.java

示例3: saveAs

import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
public static void saveAs(final SceneView scene, final EditorTopComponent editor) {
    File home = new File(System.getProperty("user.home"));

    FileChooserBuilder builder = new FileChooserBuilder("user-dir").setTitle("Save Conversation").setDefaultWorkingDirectory(home).setApproveText("Save");
    builder.setAcceptAllFileFilterUsed(true);
        
    final File file = builder.showSaveDialog();
        
    if (file != null) {
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                try {
                    handleSave(scene, editor, file.getAbsolutePath());
                } catch (ParserConfigurationException | IOException | SAXException | TransformerException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
        });
    }
}
 
开发者ID:ProjectSWGCore,项目名称:ConversationScriptCreator,代码行数:23,代码来源:SaveConversation.java

示例4: saveFileDialog

import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
public static File saveFileDialog(FileFilter fF) {
    File workDir = new File(System.getProperty("user.home"));
    FileChooserBuilder fCB = new FileChooserBuilder("user-dir").setDefaultWorkingDirectory(workDir);
    fCB.setFileFilter(fF);
    fCB.setAcceptAllFileFilterUsed(false);
    return fCB.showSaveDialog();
}
 
开发者ID:iti-luebeck,项目名称:RTeasy2,代码行数:8,代码来源:FileOperationsHelper.java

示例5: selectFile

import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private File selectFile() {
    FileChooserBuilder fcb = new FileChooserBuilder(GRScriptDataObject.class);
    fcb.setTitle(Bundle.LBL_ExampleAction_Dialog_Title());
    fcb.setApproveText(Bundle.LBL_ExampleAction_Dialog_Approve());
    fcb.addFileFilter(GRScriptFileFilter.getDefault());
    fcb.setFileFilter(GRScriptFileFilter.getDefault());
    return fcb.showSaveDialog();
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:9,代码来源:ExampleAction.java

示例6: selectFile

import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private File selectFile() {
    FileChooserBuilder fcb = new FileChooserBuilder(GRScriptDataObject.class);
    fcb.setTitle(Bundle.LBL_CreateScriptAction_Dialog_Title());
    fcb.setApproveText(Bundle.LBL_CreateScriptAction_Dialog_Approve());
    fcb.addFileFilter(GRScriptFileFilter.getDefault());
    fcb.setFileFilter(GRScriptFileFilter.getDefault());
    return fcb.showSaveDialog();
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:9,代码来源:CreateScriptAction.java

示例7: save

import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
public void save() throws IOException {
    FileChooserBuilder builder = new FileChooserBuilder(NewSceneSaveNode.class);
    builder.addFileFilter(new FileFilter() {
        @Override
        public boolean accept(File f) {
            if (f.getName().toLowerCase().trim().endsWith(".j3o")) {
                return true;
            }
            return false;
        }

        @Override
        public String getDescription() {
            return "j3o Files";
        }
    });

    final File file = builder.showSaveDialog();
    if (file == null) {
        return;
    }
    SceneApplication.getApplication().enqueue(new Callable<Void>() {
        public Void call() throws Exception {
            Spatial node = request.getRootNode();
            if (node == null) {
                return null;
            }
            if (file.exists()) {
                NotifyDescriptor.Confirmation mesg = new NotifyDescriptor.Confirmation("File exists, overwrite?",
                        "Not Saved",
                        NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE);
                DialogDisplayer.getDefault().notify(mesg);
                if (mesg.getValue() != NotifyDescriptor.Confirmation.YES_OPTION) {
                    return null;
                }
            }
            ProgressHandle progressHandle = ProgressHandle.createHandle("Saving File..");
            progressHandle.start();
            try {
                BinaryExporter exp = BinaryExporter.getInstance();
                exp.save(node, file);
            } catch (Exception e) {
            } finally {
                FileObject fo = FileUtil.toFileObject(file);
                if (fo != null) {
                    StatusDisplayer.getDefault().setStatusText(fo + " saved.");
                    fo.getParent().refresh();
                }
            }
            progressHandle.finish();
            return null;
        }
    });

}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:56,代码来源:NewSceneSaveNode.java


注:本文中的org.openide.filesystems.FileChooserBuilder.showSaveDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。