本文整理汇总了Java中org.openide.filesystems.FileChooserBuilder.showOpenDialog方法的典型用法代码示例。如果您正苦于以下问题:Java FileChooserBuilder.showOpenDialog方法的具体用法?Java FileChooserBuilder.showOpenDialog怎么用?Java FileChooserBuilder.showOpenDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.FileChooserBuilder
的用法示例。
在下文中一共展示了FileChooserBuilder.showOpenDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jButton1ActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
FileChooserBuilder builder = new FileChooserBuilder(AndroidSdkTool.class);
builder.setTitle("Please select Android SDK Folder");
builder.setDirectoriesOnly(true);
File file = builder.showOpenDialog();
if (file != null) {
FileObject folder = FileUtil.toFileObject(file);
if (folder.getFileObject("tools") == null) {
Message msg = new NotifyDescriptor.Message(
"Not a valid SDK folder!",
NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(msg);
} else {
String name = file.getPath();
jTextField1.setText(name);
}
}
}
示例2: jButton1ActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// File path = new File(jTextField1.getText());
// if (path.isDirectory()) {
FileChooserBuilder builder = new FileChooserBuilder(this.getClass());
builder.setDirectoriesOnly(true);
builder.setTitle("Select Project Folder");
File file = builder.showOpenDialog();
if (file != null) {
try {
jTextField1.setText(file.getAbsolutePath() + File.separator + jTextField2.getText());
} catch (Exception e) {
}
}
// }
}
示例3: jButton2ActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
String pathName = jTextField1.getText();
File path = new File(pathName);
if (path.isDirectory()) {
FileChooserBuilder builder = new FileChooserBuilder(getClass());
builder.setDefaultWorkingDirectory(path);
builder.setDirectoriesOnly(true);
builder.setTitle("Select Assets Folder");
File file = builder.showOpenDialog();
if (file != null) {
file = FileUtil.normalizeFile(file);
try {
jTextField2.setText(file.getAbsolutePath().substring(pathName.length(), file.getAbsolutePath().length()));
panel.fireChangeEvent();
} catch (Exception e) {
}
}
}
}
示例4: browseForFile
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void browseForFile(JTextField field) {
FileChooserBuilder builder = new FileChooserBuilder(ParserDebuggerVisualPanel.class)
.setTitle("Select input file");
File existing = new File(field.getText());
if (existing.isFile()) {
builder.setFilesOnly(true);
builder.setDefaultWorkingDirectory(existing.getParentFile());
builder.forceUseOfDefaultWorkingDirectory(true);
}
File targetFile = builder.showOpenDialog();
if (targetFile != null && targetFile.isFile()) {
field.setText(targetFile.getAbsolutePath());
}
}
示例5: browseForFile
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void browseForFile(JTextField field) {
FileChooserBuilder builder = new FileChooserBuilder(RunInTestRigVisualPanel.class)
.setTitle("Select input file");
File existing = new File(field.getText());
if (existing.isFile()) {
builder.setFilesOnly(true);
builder.setDefaultWorkingDirectory(existing.getParentFile());
builder.forceUseOfDefaultWorkingDirectory(true);
}
File targetFile = builder.showOpenDialog();
if (targetFile != null && targetFile.isFile()) {
field.setText(targetFile.getAbsolutePath());
}
}
示例6: jButton5ActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
if (loading.get()) {
return;
}
loading.set(true);
FileChooserBuilder builder = new FileChooserBuilder(this.getClass());
builder.setTitle("Select Model File");
final File file = builder.showOpenDialog();
if (file != null) {
jTextField1.setText(file.getAbsolutePath());
new Thread(new Runnable() {
public void run() {
ProgressHandle handle = ProgressHandleFactory.createHandle("Opening Model..");
handle.start();
loadModel(file);
handle.finish();
loading.set(false);
}
}).start();
}
}
示例7: browseActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void browseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseActionPerformed
// TODO add your handling code here:
FileChooserBuilder chooserBuilder = new FileChooserBuilder(SDKVisualPanelSelect.class);
chooserBuilder.setDirectoriesOnly(true);
chooserBuilder.setTitle("Choose the folder where is the Android SDK installed.");
chooserBuilder.setApproveText("OK");
File tmp = chooserBuilder.showOpenDialog();
if (tmp != null) {
path.setText(tmp.getAbsolutePath());
}
}
示例8: browseActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void browseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseActionPerformed
// TODO add your handling code here:
FileChooserBuilder chooserBuilder = new FileChooserBuilder(SDKVisualPanelInstall.class);
chooserBuilder.setDirectoriesOnly(true);
chooserBuilder.setTitle("Choose the folder in which to install Android SDK Tools.");
chooserBuilder.setApproveText("OK");
File tmp = chooserBuilder.showOpenDialog();
if (tmp != null) {
path.setText(tmp.getAbsolutePath());
}
}
示例9: getSdkPath
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
/**
* Returns a String with the path to the SDK or null if none is specified.
* @return
*/
public static String getSdkPath() {
String path = NbPreferences.forModule(AndroidSdkTool.class).get("sdk_path", null);
if (path == null) {
FileChooserBuilder builder = new FileChooserBuilder(AndroidSdkTool.class);
builder.setTitle("Please select Android SDK Folder");
builder.setDirectoriesOnly(true);
File file = builder.showOpenDialog();
if (file != null) {
FileObject folder = FileUtil.toFileObject(file);
if (folder.getFileObject("tools") == null) {
Message msg = new NotifyDescriptor.Message(
"Not a valid SDK folder!",
NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(msg);
} else {
String name = file.getPath();
NbPreferences.forModule(AndroidSdkTool.class).put("sdk_path", name);
return name;
}
}
} else {
return path;
}
return null;
}
示例10: jButton5ActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
FileChooserBuilder builder = new FileChooserBuilder(this.getClass());
builder.setTitle("Select Model File");
final File file = builder.showOpenDialog();
if (file != null) {
currentPath = file.getParent();
jTextField1.setText(file.getAbsolutePath());
loadKey(file);
}
}
示例11: getUserPath
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private FileObject getUserPath(AssetKey key) {
NotifyDescriptor.Confirmation msg = new NotifyDescriptor.Confirmation(
"Referenced file " + key.getName() + " cannot be found!\nDo you want to look for it?",
NotifyDescriptor.YES_NO_OPTION,
NotifyDescriptor.WARNING_MESSAGE);
Object result = DialogDisplayer.getDefault().notify(msg);
if (!NotifyDescriptor.YES_OPTION.equals(result)) {
return null;
}
final String ext = key.getExtension();
FileChooserBuilder fcb = new FileChooserBuilder(this.getClass());
fcb.setTitle("Locate " + key.getName());
fcb.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
if (f.getName().endsWith(ext)) {
return true;
}
return false;
}
@Override
public String getDescription() {
return "Filter for " + ext;
}
});
fcb.setFilesOnly(true);
fcb.setApproveText("Select file");
File file = fcb.showOpenDialog();
if (file == null) {
return null;
}
logger.log(Level.INFO, "Got user file input");
file = FileUtil.normalizeFile(file);
return FileUtil.toFileObject(file);
}
示例12: jButton1ActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
FileChooserBuilder builder = new FileChooserBuilder(this.getClass());
builder.setDirectoriesOnly(true);
builder.setTitle("Select Export Folder");
File file = builder.showOpenDialog();
if (file != null) {
try {
jTextField1.setText(file.getAbsolutePath());
} catch (Exception e) {
}
}
}
示例13: jButton1ActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
FileChooserBuilder builder = new FileChooserBuilder("");
builder.setDirectoriesOnly(true);
builder.setTitle("Select Blender Scripts Directory");
File file = builder.showOpenDialog();
if (file != null) {
jTextField1.setText(file.getPath());
}
}
示例14: jButton1ActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
FileChooserBuilder builder = new FileChooserBuilder(getClass());
builder.setDefaultWorkingDirectory(new File(System.getProperty("user.dir")));
builder.setDirectoriesOnly(true);
builder.setTitle("Select Project Folder");
File file = builder.showOpenDialog();
if (file != null) {
file = FileUtil.normalizeFile(file);
jTextField1.setText(file.getAbsolutePath() + File.separator);
panel.fireChangeEvent();
}
}
示例15: browseForDirectory
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void browseForDirectory(JTextField field) {
FileChooserBuilder builder = new FileChooserBuilder(CodeGenerator.class)
.setDirectoriesOnly(true);
File existing = new File(field.getText());
if (existing.isDirectory()) {
builder.setDefaultWorkingDirectory(existing);
builder.forceUseOfDefaultWorkingDirectory(true);
}
File targetDirectory = builder.showOpenDialog();
if (targetDirectory != null && targetDirectory.isDirectory()) {
field.setText(targetDirectory.getAbsolutePath());
}
}