本文整理了Java中javax.swing.JFileChooser.setAcceptAllFileFilterUsed()
方法的一些代码示例,展示了JFileChooser.setAcceptAllFileFilterUsed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFileChooser.setAcceptAllFileFilterUsed()
方法的具体详情如下:
包路径:javax.swing.JFileChooser
类名称:JFileChooser
方法名:setAcceptAllFileFilterUsed
暂无
代码示例来源:origin: osmdroid/osmdroid
@Override
public void actionPerformed(final ActionEvent e) {
final JFileChooser jfc = new JFileChooser();
jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
jfc.setAcceptAllFileFilterUsed(false);
final int result = jfc.showSaveDialog(null);
if (result == JFileChooser.APPROVE_OPTION) {
txtTempFolder.setText(jfc.getSelectedFile().getAbsolutePath());
}
}
});
代码示例来源:origin: osmdroid/osmdroid
@Override
public void actionPerformed(final ActionEvent e) {
final JFileChooser jfc = new JFileChooser();
jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
jfc.setAcceptAllFileFilterUsed(true);
final int result = jfc.showSaveDialog(null);
if (result == JFileChooser.APPROVE_OPTION) {
final String absolutePath = jfc.getSelectedFile().getAbsolutePath();
if (absolutePath.endsWith(".zip")) {
txtDestination.setText(absolutePath);
} else {
txtDestination.setText(absolutePath + ".zip");
}
}
}
});
代码示例来源:origin: skylot/jadx
public void openFile() {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setAcceptAllFileFilterUsed(true);
String[] exts = {"apk", "dex", "jar", "class", "zip", "aar", "arsc"};
String description = "supported files: " + Arrays.toString(exts).replace('[', '(').replace(']', ')');
fileChooser.setFileFilter(new FileNameExtensionFilter(description, exts));
fileChooser.setToolTipText(NLS.str("file.open_action"));
String currentDirectory = settings.getLastOpenFilePath();
if (!currentDirectory.isEmpty()) {
fileChooser.setCurrentDirectory(new File(currentDirectory));
}
int ret = fileChooser.showDialog(mainPanel, NLS.str("file.open_title"));
if (ret == JFileChooser.APPROVE_OPTION) {
settings.setLastOpenFilePath(fileChooser.getCurrentDirectory().getPath());
openFile(fileChooser.getSelectedFile());
}
}
代码示例来源:origin: plantuml/plantuml
private void displayDialogChangeDir() {
final JFileChooser chooser = new JFileChooser();
chooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
chooser.setDialogTitle("Directory to watch:");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
final String currentPath = prefs.get(KEY_DIR, ".");
chooser.setCurrentDirectory(new File(currentPath));
Log.info("Showing OpenDialog");
final int returnVal = chooser.showOpenDialog(this);
Log.info("Closing OpenDialog");
if (returnVal == JFileChooser.APPROVE_OPTION) {
final File dir = chooser.getSelectedFile();
changeDir(dir);
}
}
代码示例来源:origin: dcevm/dcevm
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Select a Java installation directory...");
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
fc.setAcceptAllFileFilterUsed(false);
Preferences p = Preferences.userNodeForPackage(Installer.class);
final String prefID = "defaultDirectory";
fc.setCurrentDirectory(new File(p.get(prefID, ".")));
if (fc.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
Path dir = fc.getSelectedFile().toPath();
p.put(prefID, dir.getParent().toString());
try {
installations.add(new Installation(config, dir));
} catch (IOException ex) {
MainWindow.showInstallerException(ex, parent);
}
}
}
}
代码示例来源:origin: stackoverflow.com
chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle(choosertitle);
chooser.setAcceptAllFileFilterUsed(false);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void btnOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenActionPerformed
JFileChooser chooser = new JFileChooser();
chooser.setAcceptAllFileFilterUsed(true);
chooser.setDialogTitle("Select OGG file");
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
代码示例来源:origin: stackoverflow.com
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle("choosertitle");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
System.out.println("getSelectedFile() : " + chooser.getSelectedFile());
} else {
System.out.println("No Selection ");
}
代码示例来源:origin: winder/Universal-G-Code-Sender
public static JFileChooser getSettingsFileChooser() {
FirmwareSettingsFileTypeFilter filter = new FirmwareSettingsFileTypeFilter();
// Setup file browser with the last path used.
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setFileHidingEnabled(true);
fileChooser.addChoosableFileFilter(filter);
fileChooser.setAcceptAllFileFilterUsed(true);
fileChooser.setFileFilter(filter);
return fileChooser;
}
代码示例来源:origin: winder/Universal-G-Code-Sender
public static JFileChooser getGcodeFileChooser(String startDir) {
//Setup the file filter for gcode files.
GcodeFileTypeFilter filter = new GcodeFileTypeFilter();
// Setup file browser with the last path used.
JFileChooser fileChooser = new JFileChooser(startDir);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setFileHidingEnabled(true);
fileChooser.addChoosableFileFilter(filter);
fileChooser.setAcceptAllFileFilterUsed(true);
fileChooser.setFileFilter(filter);
return fileChooser;
}
代码示例来源:origin: magefree/mage
protected String playerLoadDeck() {
if (fcSelectDeck == null) {
fcSelectDeck = new JFileChooser();
fcSelectDeck.setAcceptAllFileFilterUsed(false);
fcSelectDeck.addChoosableFileFilter(new DeckFilter());
}
String lastFolder = MageFrame.getPreferences().get("lastDeckFolder", "");
if (!lastFolder.isEmpty()) {
fcSelectDeck.setCurrentDirectory(new File(lastFolder));
}
int ret = fcSelectDeck.showDialog(this, "Select Deck");
if (ret == JFileChooser.APPROVE_OPTION) {
File file = fcSelectDeck.getSelectedFile();
return (file.getPath());
}
return "";
}
代码示例来源:origin: knowm/XChart
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
fileChooser.setFileFilter(
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.setDialogTitle("Export");
代码示例来源:origin: magefree/mage
/**
* Creates new form NewPlayerPanel
*/
public NewPlayerPanel() {
initComponents();
fcSelectDeck = new JFileChooser();
fcSelectDeck.setAcceptAllFileFilterUsed(false);
fcSelectDeck.addChoosableFileFilter(new DeckFilter());
String deckPath = MageFrame.getPreferences().get("defaultDeckPath", "");
if (deckPath.isEmpty()) {
if (Config.defaultDeckPath != null) {
deckPath = Config.defaultDeckPath;
}
}
this.txtPlayerDeck.setText(deckPath);
if (Config.defaultComputerName != null) {
this.txtPlayerName.setText(Config.defaultComputerName);
}
}
代码示例来源:origin: RaiMan/SikuliX2
File fileChoosen = null;
while (true) {
fchooser = new JFileChooser();
if (SX.isMac()) {
fchooser.putClientProperty("JFileChooser.packageIsTraversable", "always");
fchooser.setAcceptAllFileFilterUsed(true);
} else {
fchooser.setAcceptAllFileFilterUsed(false);
for (Object filter : filters) {
if (filter instanceof SikulixFileFilter) {
代码示例来源:origin: magefree/mage
fcSelectDeck = new JFileChooser();
fcSelectDeck.setAcceptAllFileFilterUsed(false);
fcSelectDeck.addChoosableFileFilter(new DeckFilter());
fcImportDeck = new JFileChooser();
fcImportDeck.setAcceptAllFileFilterUsed(false);
fcImportDeck.addChoosableFileFilter(new ImportFilter());
代码示例来源:origin: knowm/XChart
JFileChooser fileChooser = new JFileChooser();
FileFilter pngFileFilter = new SuffixSaveFilter("png"); // default
fileChooser.addChoosableFileFilter(pngFileFilter);
fileChooser.setAcceptAllFileFilterUsed(false);
代码示例来源:origin: stackoverflow.com
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle("select folder");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
代码示例来源:origin: stackoverflow.com
JFileChooser chooser = new JFileChooser() {
// put in all the routines as listed earlier
};
chooser.setAcceptAllFileFilterUsed(true);
int choice = chooser.showOpenDialog(null);
if (choice == JFileChooser.APPROVE_OPTION) {
String name = chooser.getSelectedFile().getAbsolutePath();
System.out.println(name);
}
代码示例来源:origin: uk.org.okapibarcode/okapibarcode
private void directoryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_directoryButtonActionPerformed
// Select save directory
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Directory Select");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
folderField.setText(chooser.getSelectedFile().getAbsolutePath()
+ File.separator);
}
}//GEN-LAST:event_directoryButtonActionPerformed
代码示例来源:origin: stackoverflow.com
JFileChooser fileDialog = new JFileChooser();
fileDialog.setAcceptAllFileFilterUsed(false);
int returnVal = fileDialog.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fileDialog.getSelectedFile();
if(file.getName().endsWith(".battle")){
System.out.println("Selected file is battle file");
}else{
System.out.println("Invalied file type");
}
}
内容来源于网络,如有侵权,请联系作者删除!