本文整理汇总了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);
}
});
}
}
示例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);
}
}
示例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);
}
}
});
}
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
});
}