本文整理汇总了Java中javax.swing.JFileChooser.removeChoosableFileFilter方法的典型用法代码示例。如果您正苦于以下问题:Java JFileChooser.removeChoosableFileFilter方法的具体用法?Java JFileChooser.removeChoosableFileFilter怎么用?Java JFileChooser.removeChoosableFileFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFileChooser
的用法示例。
在下文中一共展示了JFileChooser.removeChoosableFileFilter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFileChooser
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private static JFileChooser createFileChooser() {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fileChooser.setMultiSelectionEnabled(false);
fileChooser.setDialogTitle(Bundle.ExportSnapshotAction_FileChooserCaption());
fileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
fileChooser.setApproveButtonText(Bundle.ExportSnapshotAction_ExportButtonText());
fileChooser.removeChoosableFileFilter(fileChooser.getAcceptAllFileFilter());
fileChooser.addChoosableFileFilter(new FileFilter() {
public boolean accept(File f) {
return f.isDirectory() || f.getName().toLowerCase().endsWith(NPSS_EXT);
}
public String getDescription() {
return Bundle.ExportSnapshotAction_NpssFileFilter(NPSS_EXT);
}
});
return fileChooser;
}
示例2: getHeapDumpFile
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private static File getHeapDumpFile() {
JFileChooser chooser = new JFileChooser();
if (importDir != null) {
chooser.setCurrentDirectory(importDir);
}
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setMultiSelectionEnabled(false);
chooser.setDialogType(JFileChooser.OPEN_DIALOG);
chooser.removeChoosableFileFilter(chooser.getAcceptAllFileFilter());
chooser.addChoosableFileFilter(new FileFilterImpl());
chooser.setDialogTitle(
Bundle.OpenHeapWalkerAction_DialogCaption()
);
if (chooser.showOpenDialog(WindowManager.getDefault().getMainWindow()) == JFileChooser.APPROVE_OPTION) {
importDir = chooser.getCurrentDirectory();
return chooser.getSelectedFile();
}
return null;
}
示例3: onExportFilenameBrowseClick
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void onExportFilenameBrowseClick() {
File oldFile = getExecutableFile();
JFileChooser fileChooser = new AccessibleJFileChooser(NbBundle.getMessage(MercurialOptionsPanelController.class, "ACSD_ExportBrowseFolder"), oldFile); // NOI18N
fileChooser.setDialogTitle(NbBundle.getMessage(MercurialOptionsPanelController.class, "ExportBrowse_title")); // NOI18N
fileChooser.setMultiSelectionEnabled(false);
FileFilter[] old = fileChooser.getChoosableFileFilters();
for (int i = 0; i < old.length; i++) {
FileFilter fileFilter = old[i];
fileChooser.removeChoosableFileFilter(fileFilter);
}
fileChooser.showDialog(panel, NbBundle.getMessage(MercurialOptionsPanelController.class, "OK_Button")); // NOI18N
File f = fileChooser.getSelectedFile();
if (f != null) {
panel.exportFilenameTextField.setText(f.getAbsolutePath());
}
}
示例4: open
import javax.swing.JFileChooser; //导入方法依赖的package包/类
void open() throws IOException {
JFileChooser chooser = haxby.map.MapApp.getFileChooser();
int mode = chooser.getFileSelectionMode();
boolean multi = chooser.isMultiSelectionEnabled();
chooser.setMultiSelectionEnabled( true );
chooser.setFileSelectionMode( JFileChooser.FILES_ONLY );
chooser.addChoosableFileFilter(imageFileFilter);
int ok = chooser.showOpenDialog(frame);
File[] choice = null;
if( ok!=chooser.CANCEL_OPTION ) choice = chooser.getSelectedFiles();
chooser.setMultiSelectionEnabled(multi);
chooser.setFileSelectionMode( mode );
chooser.removeChoosableFileFilter(imageFileFilter);
if( ok==chooser.CANCEL_OPTION ) {
return;
}
if (mapType == MapApp.MERCATOR_MAP)
openImagesMercator(choice);
else
openImagesPolar(choice);
}
示例5: apply
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/**
* Applies the file filter list
*
* @param chooser
*/
public void apply(JFileChooser chooser) {
for (FileFilter choosableFileFilter : chooser.getChoosableFileFilters()) {
chooser.removeChoosableFileFilter(choosableFileFilter);
}
for (FileFilter fileFilter : this) {
chooser.addChoosableFileFilter(fileFilter);
}
}
示例6: loadFromFile
import javax.swing.JFileChooser; //导入方法依赖的package包/类
public void loadFromFile() {
final JFileChooser chooser = new AccessibleJFileChooser(NbBundle.getMessage(SvnProperties.class, "ACSD_Properties"));
chooser.setDialogTitle(NbBundle.getMessage(SvnProperties.class, "CTL_Load_Value_Title"));
chooser.setMultiSelectionEnabled(false);
javax.swing.filechooser.FileFilter[] fileFilters = chooser.getChoosableFileFilters();
for (int i = 0; i < fileFilters.length; i++) {
javax.swing.filechooser.FileFilter fileFilter = fileFilters[i];
chooser.removeChoosableFileFilter(fileFilter);
}
chooser.setCurrentDirectory(roots[0].getParentFile()); // NOI18N
chooser.addChoosableFileFilter(new javax.swing.filechooser.FileFilter() {
@Override
public boolean accept(File f) {
return f.exists();
}
@Override
public String getDescription() {
return "";
}
});
chooser.setDialogType(JFileChooser.OPEN_DIALOG);
chooser.setApproveButtonMnemonic(NbBundle.getMessage(SvnProperties.class, "MNE_LoadValue").charAt(0));
chooser.setApproveButtonText(NbBundle.getMessage(SvnProperties.class, "CTL_LoadValue"));
DialogDescriptor dd = new DialogDescriptor(chooser, NbBundle.getMessage(SvnProperties.class, "CTL_Load_Value_Title"));
dd.setOptions(new Object[0]);
final Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
chooser.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String state = e.getActionCommand();
if (state.equals(JFileChooser.APPROVE_SELECTION)) {
File source = chooser.getSelectedFile();
if (Utils.isFileContentText(source)) {
if (source.canRead()) {
StringWriter sw = new StringWriter();
try {
Utils.copyStreamsCloseAll(sw, new FileReader(source));
panel.txtAreaValue.setText(sw.toString());
} catch (IOException ex) {
Subversion.LOG.log(Level.SEVERE, null, ex);
}
}
} else {
handleBinaryFile(source);
}
}
dialog.dispose();
}
});
dialog.setVisible(true);
}
示例7: createFileChooser
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private JFileChooser createFileChooser(File curentDir) {
final JFileChooser chooser = new AccessibleJFileChooser(NbBundle.getMessage(ExportDiffSupport.class, "ACSD_Export"));
chooser.setDialogTitle(NbBundle.getMessage(ExportDiffSupport.class, "CTL_Export_Title"));
chooser.setMultiSelectionEnabled(false);
javax.swing.filechooser.FileFilter[] old = chooser.getChoosableFileFilters();
for (int i = 0; i < old.length; i++) {
javax.swing.filechooser.FileFilter fileFilter = old[i];
chooser.removeChoosableFileFilter(fileFilter);
}
chooser.setCurrentDirectory(curentDir); // NOI18N
chooser.addChoosableFileFilter(getFileFilter());
chooser.setDialogType(JFileChooser.SAVE_DIALOG);
chooser.setApproveButtonMnemonic(NbBundle.getMessage(ExportDiffSupport.class, "MNE_Export_ExportAction").charAt(0));
chooser.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String state = e.getActionCommand();
if (state.equals(JFileChooser.APPROVE_SELECTION)) {
File destination = chooser.getSelectedFile();
destination = getTargetFile(destination);
if (destination.exists()) {
NotifyDescriptor nd = new NotifyDescriptor.Confirmation(NbBundle.getMessage(ExportDiffSupport.class, "BK3005", destination.getAbsolutePath()));
nd.setOptionType(NotifyDescriptor.YES_NO_OPTION);
DialogDisplayer.getDefault().notify(nd);
if (nd.getValue().equals(NotifyDescriptor.OK_OPTION) == false) {
return;
}
}
preferences.put("ExportDiff.saveFolder", destination.getParent()); // NOI18N
panel.setOutputFileText(destination.getAbsolutePath());
} else {
dd.setValue(null);
}
if(dialog != null) {
dialog.dispose();
}
}
});
return chooser;
}