Package javax.swing.filechooser

Examples of javax.swing.filechooser.FileFilter


    public PlotToolBar(PlotPanel pp) {
        plotPanel = pp;
        plotCanvas = pp.plotCanvas;
         try {
            pngFileChooser = new JFileChooser();
            pngFileChooser.setFileFilter(new FileFilter() {
                public boolean accept(File f) {
                    return f.isDirectory() || f.getName().endsWith(".png");
  }

                public String getDescription() {
View Full Code Here


        if(chooser.showOpenDialog(parent==null?null:parent) == JFileChooser.APPROVE_OPTION) {
            selectedFilePath = chooser.getSelectedFile().getAbsolutePath();
            selectedFilePaths = filesToList(chooser.getSelectedFiles());
            if(extensions != null && extensions.size() >= 0) {
                FileFilter ff = chooser.getFileFilter();
                if(ff instanceof XJFileFilter) {
                    XJFileFilter filter = (XJFileFilter)ff;
                    if(selectedFilePath.indexOf(".") == -1)
                        selectedFilePath += "."+filter.getDefaultExtension();
                }
View Full Code Here

        return result;
    }

    private String getExtension(List extensions, JFileChooser chooser) {
        if(extensions != null && extensions.size() >= 0) {
            FileFilter ff = chooser.getFileFilter();
            if(ff instanceof XJFileFilter) {
                XJFileFilter filter = (XJFileFilter)ff;
                if(!filter.accept(selectedFilePath))
                    return filter.getDefaultExtension();
            }
View Full Code Here

      e.printStackTrace();
    }

    int retValue = fileChooser.showSaveDialog(this);
    if (retValue == JFileChooser.APPROVE_OPTION) {
      FileFilter fileFilter = fileChooser.getFileFilter();
      File file = fileChooser.getSelectedFile();
      String lowerCaseFileName = file.getName().toLowerCase();

      try {
        if (fileFilter instanceof JRSaveContributor) {
View Full Code Here

        @Override
        public void approveSelection() {
            File file = getSelectedFile();
            if (file != null) {
                FileFilter filter = getFileFilter();
                if (filter != null &&
                    filter instanceof FileNameExtensionFilter) {
                    String[] extensions =
                        ((FileNameExtensionFilter) filter).getExtensions();
View Full Code Here

    public void actionPerformed(final ActionEvent e) {
      final FileChooserDescriptor descriptor = new FilterFileChooserDescriptor(
          "Select",
          "Select a file to import",
          new FileFilter() {
            @Override
            public boolean accept(final File f) {
              return f.isDirectory() || "xml".equalsIgnoreCase(FileUtilRt.getExtension(f.getAbsolutePath()));
            }
View Full Code Here

       
        JFileChooser chooser = new JFileChooser();
        chooser.setDialogTitle("Deploy Parcel To Office Document");
        chooser.setApproveButtonText("Deploy");
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        chooser.setFileFilter(new FileFilter() {
            public boolean accept(File file) {
                if (file.isDirectory() ||
                    file.getName().endsWith(".sxw") ||
                    file.getName().endsWith(".sxc") ||
                    file.getName().endsWith(".sxd") ||
View Full Code Here

   * @return The <code>File</code> which the report should be saved into, or <code>null</code> if the user
   *         does not want to continue with the save operation
   */
  public static File promptReportFilename(final Component parent, final File defaultFile)
  {
    final FileFilter filter = new FilesystemFilter
        (new String[]{DEFAULT_EXTENSION},
            ActionMessages.getString("ReportBundleFileExtension.Description"), true);

    final CommonFileChooser fileChooser = FileChooserService.getInstance().getFileChooser("report");
    fileChooser.setSelectedFile(defaultFile);
View Full Code Here

   * @return The <code>File</code> which the report should be saved into, or <code>null</code> if the user
   *         does not want to continue with the save operation
   */
  public static File promptReportFilename(final Component parent, final File defaultFile)
  {
    final FileFilter filter = new FilesystemFilter
        (new String[]{DEFAULT_EXTENSION},
            Messages.getString("StyleDefinitionUtilities.FileDescription"), true);

    final CommonFileChooser fileChooser = FileChooserService.getInstance().getFileChooser(FILE_CHOOSER_TYPE);
    fileChooser.setSelectedFile(defaultFile);
View Full Code Here

  /**
   * Invoked when an action occurs.
   */
  public static void openStyleDefinition(final StyleDefinitionEditorContext context)
  {
    final FileFilter filter = new FilesystemFilter
        (new String[]{DEFAULT_EXTENSION},
            Messages.getString("StyleDefinitionUtilities.FileDescription"), true);

    final CommonFileChooser fileChooser = FileChooserService.getInstance().getFileChooser(FILE_CHOOSER_TYPE);
    fileChooser.setFilters(new FileFilter[]{filter});
View Full Code Here

TOP

Related Classes of javax.swing.filechooser.FileFilter

Copyright © 2018 www.massapicom. 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.