本文整理汇总了Java中javax.swing.JFileChooser.setFileHidingEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java JFileChooser.setFileHidingEnabled方法的具体用法?Java JFileChooser.setFileHidingEnabled怎么用?Java JFileChooser.setFileHidingEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFileChooser
的用法示例。
在下文中一共展示了JFileChooser.setFileHidingEnabled方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: certBrowseButtonActionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void certBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_certBrowseButtonActionPerformed
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setFileHidingEnabled(false);
String text = UiUtils.getValue(certTextField);
if (text != null) {
chooser.setSelectedFile(new File(text));
}
if (chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this)) == JFileChooser.APPROVE_OPTION) {
certTextField.setText(chooser.getSelectedFile().getAbsolutePath());
}
}
示例2: selectAppBrowseB_actionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
if (lastSel != null)
chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
applicationField.setText(chooser.getSelectedFile().getPath());
}
示例3: LoadDialog
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/**
* Creates a dialog to choose a file to load.
*
* @param freeColClient The {@code FreeColClient} for the game.
* @param frame The owner frame.
* @param directory The directory to display when choosing the file.
* @param fileFilters The available file filters in the dialog.
*/
public LoadDialog(FreeColClient freeColClient, JFrame frame,
File directory, FileFilter[] fileFilters) {
super(freeColClient, frame);
final JFileChooser fileChooser = new JFileChooser(directory);
if (fileFilters.length > 0) {
for (FileFilter fileFilter : fileFilters) {
fileChooser.addChoosableFileFilter(fileFilter);
}
fileChooser.setFileFilter(fileFilters[0]);
fileChooser.setAcceptAllFileFilterUsed(false);
}
fileChooser.setControlButtonsAreShown(true);
fileChooser.setApproveButtonText(Messages.message("ok"));
//fileChooser.setCancelButtonText(Messages.message("cancel"));
fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setFileHidingEnabled(false);
fileChooser.addActionListener((ActionEvent ae) -> {
final String cmd = ae.getActionCommand();
File value = (JFileChooser.APPROVE_SELECTION.equals(cmd))
? ((JFileChooser)ae.getSource()).getSelectedFile()
: cancelFile;
setValue(value);
});
List<ChoiceItem<File>> c = choices();
initializeDialog(frame, DialogType.QUESTION, true, fileChooser, null, c);
}
示例4: browseButtonActionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
JFileChooser chooser = new JFileChooser();
chooser.setFileHidingEnabled(false);
FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
chooser.setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY);
chooser.setMultiSelectionEnabled(false);
chooser.setDialogTitle(NbBundle.getBundle(VariablePanel.class).getString("MSG_Choose_Folder"));
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
File file = FileUtil.normalizeFile(chooser.getSelectedFile());
locationTextField.setText(file.getAbsolutePath());
}
}
示例5: prepareFileChooser
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void prepareFileChooser(JFileChooser chooser) {
chooser.setFileSelectionMode(dirsOnly ? JFileChooser.DIRECTORIES_ONLY
: filesOnly ? JFileChooser.FILES_ONLY :
JFileChooser.FILES_AND_DIRECTORIES);
chooser.setFileHidingEnabled(fileHiding);
chooser.setControlButtonsAreShown(controlButtonsShown);
chooser.setAcceptAllFileFilterUsed(useAcceptAllFileFilter);
if (title != null) {
chooser.setDialogTitle(title);
}
if (approveText != null) {
chooser.setApproveButtonText(approveText);
}
if (badger != null) {
chooser.setFileView(new CustomFileView(new BadgeIconProvider(badger),
chooser.getFileSystemView()));
}
if (PREVENT_SYMLINK_TRAVERSAL) {
FileUtil.preventFileChooserSymlinkTraversal(chooser,
chooser.getCurrentDirectory());
}
if (filter != null) {
chooser.setFileFilter(filter);
}
if (aDescription != null) {
chooser.getAccessibleContext().setAccessibleDescription(aDescription);
}
if (!filters.isEmpty()) {
for (FileFilter f : filters) {
chooser.addChoosableFileFilter(f);
}
}
}
示例6: browseTemplate
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void browseTemplate() {
JFileChooser chooser = new JFileChooser();
chooser.setFileHidingEnabled(false);
chooser.setDialogTitle(Local.getString("Select file"));
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (templF.getText().length() >0)
chooser.setCurrentDirectory(new java.io.File(templF.getText()));
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
templF.setText(chooser.getSelectedFile().getPath());
}
示例7: browseB_actionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/**
* setup the JFileChooser so the user can select the resource file
*/
void browseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText",
Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText",
Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText",
Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText",
Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText",
Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText",
Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText",
Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText",
Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText",
Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText",
Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText",
Local.getString("Cancel"));
JFileChooser chooser = new JFileChooser();
chooser.setFileHidingEnabled(false);
chooser.setDialogTitle(Local.getString("Add resource"));
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setPreferredSize(new Dimension(550, 375));
/*java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_RESOURCE_FILE");
if (lastSel != null)
chooser.setCurrentDirectory(lastSel);*/
if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
return;
/*try {
Context.put("LAST_SELECTED_RESOURCE_FILE", chooser.getSelectedFile());
}
catch (Exception ex) {}*/
pathField.setText(chooser.getSelectedFile().getPath());
checkOkEnabled();
}
示例8: importB_actionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
void importB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local
.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local
.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local
.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local
.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local
.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local
.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local
.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local
.getString("Open selected file"));
UIManager
.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local
.getString("Cancel"));
JFileChooser chooser = new JFileChooser();
chooser.setFileHidingEnabled(false);
chooser.setDialogTitle(Local.getString("Insert file"));
chooser.setAcceptAllFileFilterUsed(false);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.addChoosableFileFilter(new AllFilesFilter(AllFilesFilter.HTML));
chooser.setPreferredSize(new Dimension(550, 375));
String lastSel = (String) Context.get("LAST_SELECTED_IMPORT_FILE");
if (lastSel != null)
chooser.setCurrentDirectory(new java.io.File(lastSel));
if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
return;
Context.put("LAST_SELECTED_IMPORT_FILE", chooser.getSelectedFile()
.getPath());
File f = chooser.getSelectedFile();
new HTMLFileImport(f, editor);
}
示例9: setIconB_actionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
void setIconB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");
JFileChooser chooser = new JFileChooser();
chooser.setPreferredSize(new Dimension(550, 375));
chooser.setFileHidingEnabled(false);
chooser.setDialogTitle(Local.getString("Choose icon file"));
//chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setCurrentDirectory(
new File(net.sf.memoranda.ui.AppFrame.class.getResource("resources/icons/mimetypes").getPath()));
/*if (System.getProperty("os.name").startsWith("Win")) {
chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.ICO));
chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
else */
chooser.addChoosableFileFilter(new net.sf.memoranda.ui.htmleditor.filechooser.ImageFilter());
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
try {
iconLabel.setIcon(new ImageIcon(chooser.getSelectedFile().getPath()));
}
catch (Exception ex) {
//ex.printStackTrace();
}
finally {
iconPath = chooser.getSelectedFile().getPath();
}
}
}
示例10: addJarButtonActionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void addJarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addJarButtonActionPerformed
JFileChooser chooser = FileEditor.createHackedFileChooser();
chooser.setFileHidingEnabled(false);
setHelpToChooser( chooser );
chooser.setFileFilter(new FileFilter() {
public boolean accept(File f) {
return (f.isDirectory() || f.getName().endsWith(".jar") || f.getName().endsWith(".zip")); // NOI18N
}
public String getDescription() {
return getString("CTL_JarArchivesMask");
}
});
if (lastJarFolder != null) {
chooser.setCurrentDirectory(lastJarFolder);
}
chooser.setDialogTitle(getString("CTL_FileSystemPanel.Jar_Dialog_Title"));
chooser.setMultiSelectionEnabled( true );
if (chooser.showDialog(this,
getString("CTL_Approve_Button_Title"))
== JFileChooser.APPROVE_OPTION) {
File[] files = chooser.getSelectedFiles();
boolean found = false;
for (int i=0; i<files.length; i++) {
if ((files[i] != null) && (files[i].isFile())) {
found = true;
String path = files[i].getAbsolutePath();
if (! listModel.contains (path)) {
listModel.addElement (path);
}
}
}
if ( found ) {
lastJarFolder = chooser.getCurrentDirectory();
fireValueChanged();
}
pathList.setSelectedIndex(listModel.size() - 1);
}
}
示例11: setIconB_actionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
void setIconB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");
JFileChooser chooser = new JFileChooser();
chooser.setPreferredSize(new Dimension(550, 375));
chooser.setFileHidingEnabled(false);
chooser.setDialogTitle(Local.getString("Choose icon file"));
//chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setCurrentDirectory(
new File(net.sf.memoranda.ui.AppFrame.class.getResource("/ui/icons/mimetypes").getPath()));
/*if (System.getProperty("os.name").startsWith("Win")) {
chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.ICO));
chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
else */
chooser.addChoosableFileFilter(new net.sf.memoranda.ui.htmleditor.filechooser.ImageFilter());
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
try {
iconLabel.setIcon(new ImageIcon(chooser.getSelectedFile().getPath()));
}
catch (Exception ex) {
//ex.printStackTrace();
}
finally {
iconPath = chooser.getSelectedFile().getPath();
}
}
}