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


Java FileChooserBuilder.setDefaultWorkingDirectory方法代码示例

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


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

示例1: 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) {
            }
        }
    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:20,代码来源:CodelessProjectWizardVisualPanel1.java

示例2: 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());
    }
}
 
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:17,代码来源:ParserDebuggerVisualPanel.java

示例3: 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());
    }
}
 
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:17,代码来源:RunInTestRigVisualPanel.java

示例4: actionPerformed

import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
/** Handles button events
 */        
public void actionPerformed( ActionEvent e ) {
    
    Object source = e.getSource();
    
    if ( source == addFolderButton ) { 
        
        // Let user search for the Jar file
        FileChooserBuilder builder = new FileChooserBuilder(SourceRootsUi.class).setDirectoriesOnly(true);
        builder.setDefaultWorkingDirectory(FileUtil.toFile(this.project.getProjectDirectory()));
        String type = RootsAccessor.getInstance().getType(sourceRoots);
        boolean isModule = JavaProjectConstants.SOURCES_TYPE_MODULES.equals(type);
        if (sourceRoots.isTest()) {
            builder.setTitle(NbBundle.getMessage(SourceRootsUi.class, isModule ? "LBL_TestModuleFolder_DialogTitle" : "LBL_TestFolder_DialogTitle"));  // NOI18N
        } else {
            builder.setTitle(NbBundle.getMessage(SourceRootsUi.class, isModule ? "LBL_ModuleFolder_DialogTitle" : "LBL_SourceFolder_DialogTitle")); // NOI18N
        }
        File files[] = builder.showMultiOpenDialog();
        if ( files != null ) {
            addFolders( files );
        }
    }
    else if ( source == removeButton ) { 
        removeElements();
    }
    else if ( source == upButton ) {
        moveUp();
    }
    else if ( source == downButton ) {
        moveDown();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:SourceRootsUi.java

示例5: 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();
    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:13,代码来源:CodelessProjectWizardVisualPanel1.java

示例6: 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());
    }
}
 
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:16,代码来源:CodeGeneratorVisualPanel1.java


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