Package javax.swing.filechooser

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


  @Override
  public void approveSelection() {
    File f = getSelectedFile();

    FileFilter ff = getFileFilter();
    if (!ff.accept(f)) {
      f = new File(f.getPath() + "." + getDefaultExtension());
    }
    super.setSelectedFile(f);
    if (f.exists() && getDialogType() == SAVE_DIALOG) {
      int result = JOptionPane.showConfirmDialog(this, "The file exists, overwrite?", "Existing file", JOptionPane.YES_NO_CANCEL_OPTION);
View Full Code Here


        }

        protected String maybeFrobPath(String path) {
            FileFilter filter = fileChooser.getFileFilter();
            File file = new File(path);
            if (!filter.accept(file)) {
                if (filter == pdashFilter)
                    path = path + DataImporter.EXPORT_FILE_SUFFIX;
                else if (filter == txtFilter)
                    path = path + DataImporter.EXPORT_FILE_OLD_SUFFIX;
            }
View Full Code Here

      File[] dirEntries = directory.listFiles();
      for (File entry : dirEntries) {
        logger.log(Level.FINEST, "add a picture " + entry.getName()
            + " to picture box");
        FileFilter filter = new PictureFilter();
        if (entry.isFile() && filter.accept(entry)) {
          try {
            pic = new Picture(entry);
            pic.registerMetaDataReader(new SanselanReader());
            pictureList.add(pic);
          } catch (FileTypeNotSupportedException ftnse) {
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

            return character;
        }
        DataFlavor selectedDf = getDataFlavorFromFile(savePath[0]);
        if (selectedDf == null) {
            ff = fcp.getFiles().getFileFilter();
            if (ff.accept(new File("file"))) {
                selectedDf = (DataFlavor) UIMessage.showSelectDialog(applet, "What document type to you want to save ?", "Document type is unknown", _dataFlavors, InteractiveModel._dataFlavor);
            } else if (ff.accept(new File("file." + Custom._MIME_EXT[0]))) {
                selectedDf = Custom._dataFlavor;
            } else if (ff.accept(new File("file." + Model._MIME_EXT[0]))) {
                selectedDf = Model._dataFlavor;
View Full Code Here

        DataFlavor selectedDf = getDataFlavorFromFile(savePath[0]);
        if (selectedDf == null) {
            ff = fcp.getFiles().getFileFilter();
            if (ff.accept(new File("file"))) {
                selectedDf = (DataFlavor) UIMessage.showSelectDialog(applet, "What document type to you want to save ?", "Document type is unknown", _dataFlavors, InteractiveModel._dataFlavor);
            } else if (ff.accept(new File("file." + Custom._MIME_EXT[0]))) {
                selectedDf = Custom._dataFlavor;
            } else if (ff.accept(new File("file." + Model._MIME_EXT[0]))) {
                selectedDf = Model._dataFlavor;
            } else if (ff.accept(new File("file." + InteractiveModel._MIME_EXT[0]))) {
                selectedDf = InteractiveModel._dataFlavor;
View Full Code Here

            ff = fcp.getFiles().getFileFilter();
            if (ff.accept(new File("file"))) {
                selectedDf = (DataFlavor) UIMessage.showSelectDialog(applet, "What document type to you want to save ?", "Document type is unknown", _dataFlavors, InteractiveModel._dataFlavor);
            } else if (ff.accept(new File("file." + Custom._MIME_EXT[0]))) {
                selectedDf = Custom._dataFlavor;
            } else if (ff.accept(new File("file." + Model._MIME_EXT[0]))) {
                selectedDf = Model._dataFlavor;
            } else if (ff.accept(new File("file." + InteractiveModel._MIME_EXT[0]))) {
                selectedDf = InteractiveModel._dataFlavor;
            } else if (ff.accept(new File("file." + XtendedModel._MIME_EXT[0]))) {
                selectedDf = XtendedModel._dataFlavor;
View Full Code Here

                selectedDf = (DataFlavor) UIMessage.showSelectDialog(applet, "What document type to you want to save ?", "Document type is unknown", _dataFlavors, InteractiveModel._dataFlavor);
            } else if (ff.accept(new File("file." + Custom._MIME_EXT[0]))) {
                selectedDf = Custom._dataFlavor;
            } else if (ff.accept(new File("file." + Model._MIME_EXT[0]))) {
                selectedDf = Model._dataFlavor;
            } else if (ff.accept(new File("file." + InteractiveModel._MIME_EXT[0]))) {
                selectedDf = InteractiveModel._dataFlavor;
            } else if (ff.accept(new File("file." + XtendedModel._MIME_EXT[0]))) {
                selectedDf = XtendedModel._dataFlavor;
            }
        }
View Full Code Here

                selectedDf = Custom._dataFlavor;
            } else if (ff.accept(new File("file." + Model._MIME_EXT[0]))) {
                selectedDf = Model._dataFlavor;
            } else if (ff.accept(new File("file." + InteractiveModel._MIME_EXT[0]))) {
                selectedDf = InteractiveModel._dataFlavor;
            } else if (ff.accept(new File("file." + XtendedModel._MIME_EXT[0]))) {
                selectedDf = XtendedModel._dataFlavor;
            }
        }
        applet.setEnabled(false);
        if (selectedDf instanceof DataFlavor) {
View Full Code Here

        boolean acceptedFile = true;
        JFileChooser fileChooser = fileChooserBuilder.getFileChooser();
        FileFilter ffilter = fileChooser.getFileFilter();
        if (ffilter != null &&
                ! ffilter.equals(fileChooser.getAcceptAllFileFilter())) {
            acceptedFile = ffilter.accept(getSelectedFile());
        }
       
        if (fileChooser.getFileSelectionMode() ==
                JFileChooser.DIRECTORIES_ONLY) {           
            return acceptedFile && file.isDirectory();
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.