Package javax.swing.filechooser

Examples of javax.swing.filechooser.FileFilter.accept()


        if (transferFile.isFile()) {

            FileFilter filter = FileFilters.getApplicationFilter();

            if (filter.accept(transferFile)) {
                ActionEvent e = new ActionEvent(
                        transferFile,
                        ActionEvent.ACTION_PERFORMED,
                        "OpenProject");
                Application.getInstance().getActionManager().getAction(
View Full Code Here


                }
            };
            final ImageIcon icon = ImageUtil.loadIcon("icons/script.png");
            fileChooser.setFileView(new FileView() {
                private Script load(File f) {
                    if(!filter.accept(f))
                        return null;
                    try {
                        return Script.open(f.getAbsolutePath());
                    } catch(Exception e) {
                        /**/
 
View Full Code Here

        for (int i = 0; i < files.length; i++) {
            File file = files[i];

            if ((file.isDirectory() && (fc.isDirectorySelectionEnabled() || fc.isTraversable(file))
                 || file.isFile() && fc.isFileSelectionEnabled())
                && (filter == null || filter.accept(file))) {

                fileList.add(file);
            }
        }
        sort(fileList);
View Full Code Here

        if (transferFile.isFile()) {

            FileFilter filter = FileFilters.getApplicationFilter();

            if (filter.accept(transferFile)) {
                ActionEvent e = new ActionEvent(
                        transferFile,
                        ActionEvent.ACTION_PERFORMED,
                        "OpenProject");
                Application.getInstance().getActionManager().getAction(
View Full Code Here

        for (int i = 0; i < files.length; i++) {
            File file = files[i];

            if ((file.isDirectory() && (fc.isDirectorySelectionEnabled() || fc.isTraversable(file))
                 || file.isFile() && fc.isFileSelectionEnabled())
                && (filter == null || filter.accept(file))) {

                fileList.add(file);
            }
        }
        sort(fileList);
View Full Code Here

  {
    if (f == null)
      return true;
    FileFilter ff = getFileFilter();
    if (ff != null)
      return ff.accept(f);
    else
      return true;
  }

  /**
 
View Full Code Here

        }
        int iVal = fileChooser.showSaveDialog(owner);
        if (iVal == JFileChooser.APPROVE_OPTION) {
            file = fileChooser.getSelectedFile();
            FileFilter currentFilter = fileChooser.getFileFilter();
            if (!currentFilter.accept(file) && currentFilter instanceof ChoosableFileFilter) {
                file = new File(file.getAbsolutePath() + "." //$NON-NLS-1$
                                + ((ChoosableFileFilter) currentFilter).getExtension());
            }
            if (fileSaver != null) {
                fileSaver.saveToFile(file);
View Full Code Here

    private static File checkFileAndConfirmOverWrite(JFileChooser fc, String extension) {
        if (fc == null) return null;
        File file = fc.getSelectedFile();

        FileFilter ff = fc.getFileFilter();
        if (!ff.accept(file)) {
            // Extension of another filefilter given ?
            for (FileFilter cff : fc.getChoosableFileFilters()) {
                if (cff.accept(file)) {
                    fc.setFileFilter(cff);
                    return file;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.