Package javax.swing.filechooser

Examples of javax.swing.filechooser.FileNameExtensionFilter


  }

  private void loadDataDialog() {
    final JFileChooser fileChooser = new JFileChooser();
    fileChooser
    .setFileFilter(new FileNameExtensionFilter("N3 Files", "n3"));

    if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
      this.dataFile = FileHelper.readFile(fileChooser.getSelectedFile()
          .getAbsolutePath());
View Full Code Here


    loadMI.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(final ActionEvent ae) {
        final JFileChooser chooser = new JFileChooser(System.getProperty("user.dir"));
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        chooser.setFileFilter(new FileNameExtensionFilter("JSON Save files", "json"));

        if(chooser.showDialog(VisualRifEditor.this.that, "Open") == JFileChooser.APPROVE_OPTION) {
          final String fileName = chooser.getSelectedFile().getAbsolutePath();

          VisualRifEditor.this.that.saveLoader.load(fileName);
        }
      }
    });

    // create JMenuItem to save...
    final JMenuItem saveMI = new JMenuItem("Save File");
    saveMI.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(final ActionEvent ae) {

        final SaveDialog chooser = new SaveDialog(System.getProperty("user.dir"));
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        chooser.setFileFilter(new FileNameExtensionFilter("JSON Save files", "json"));

        if(chooser.showDialog(VisualRifEditor.this.that, "Save") == SaveDialog.APPROVE_OPTION) {
          String fileName = chooser.getSelectedFile().getAbsolutePath();

          if(!fileName.endsWith(".json")) {
            fileName += ".json";
          }

          VisualRifEditor.this.that.saveLoader.save(fileName);
        }
      }
    });


    final JMenuItem importMI = new JMenuItem("Import Document");
    importMI.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(final ActionEvent ae) {
        final JFileChooser chooser = new JFileChooser(System.getProperty("user.dir"));
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        chooser.setFileFilter(new FileNameExtensionFilter("rif document", "txt","rif"));

        if(chooser.showDialog(VisualRifEditor.this.that, "Import") == JFileChooser.APPROVE_OPTION) {
          final String fileName = chooser.getSelectedFile().getAbsolutePath();

          VisualRifEditor.this.that.importNewDocument(FileHelper.fastReadFile(fileName));
        }
      }
    });

    final JMenuItem exportMI = new JMenuItem("Export Document");
    exportMI.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(final ActionEvent ae) {

        final SaveDialog chooser = new SaveDialog(System.getProperty("user.dir"));
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        chooser.setFileFilter(new FileNameExtensionFilter("rif document", "txt","rif"));

        if(chooser.showDialog(VisualRifEditor.this.that, "Export") == SaveDialog.APPROVE_OPTION) {
          String fileName = chooser.getSelectedFile().getAbsolutePath();

          if(!fileName.endsWith(".rif")) {
View Full Code Here

  }

  private void loadDataDialog() {
    final JFileChooser fileChooser = new JFileChooser();
    fileChooser
    .setFileFilter(new FileNameExtensionFilter("N3 Files", "n3"));

    if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
      this.clearCanvas();

      this.parseN3Data(FileHelper.readFile(fileChooser.getSelectedFile()
View Full Code Here

   */
  public void loadConfigDialog() {
    JFileChooser chooser = new JFileChooser(
        "src/main/resources/htmlTemplates");
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.setFileFilter(new FileNameExtensionFilter("json", "json"));
    chooser.setAcceptAllFileFilterUsed(false);
    if (chooser.showDialog(this.view.getFrame(), "Open") == JFileChooser.APPROVE_OPTION) {
      load(chooser.getSelectedFile());
    }
  }
View Full Code Here

   */
  private void saveConfigDialog() {
    JFileChooser chooser = new JFileChooser(
        "src/main/resources/htmlTemplates");
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.setFileFilter(new FileNameExtensionFilter("json", "json"));
    chooser.setAcceptAllFileFilterUsed(false);

    if (chooser.showSaveDialog(this.view.getFrame()) == JFileChooser.APPROVE_OPTION) {
      String path = chooser.getSelectedFile().getPath();

View Full Code Here

    protected void browseScriptFile() {
        AFileChooser fileChooser;
        fileChooser = new AFileChooser((java.awt.Frame) null, true, LAST_TASK_PATH_KEY);
        fileChooser.setDialogTitle("Start script");
        FileNameExtensionFilter filter = new FileNameExtensionFilter("starScript files", "starScript");
        fileChooser.addChoosableFileFilter(filter);
        filter = new FileNameExtensionFilter("text files", "txt");
        fileChooser.setAcceptAllFileFilterUsed(true);
        int option = fileChooser.showOpenDialog(null);
        if (option != JFileChooser.APPROVE_OPTION) {
            //scriptFile = null;//keep previous file
        }
View Full Code Here

     * @return true if the user chose a file
     * @throws IOException
     */
    public boolean askForArgFile(List<FileNameExtensionFilter> customFilters, boolean txtFilter, boolean argFilter, boolean acceptAll) throws IOException {
        List<FileNameExtensionFilter> filters = new ArrayList<FileNameExtensionFilter>();
        FileNameExtensionFilter filter;
        if (null != customFilters) {
            filters.addAll(customFilters);
        }
        if (argFilter) {
            filter = new FileNameExtensionFilter("arg files", "arg");
            filters.add(filter);
        }
        if (txtFilter) {
            filter = new FileNameExtensionFilter("txt files", "txt");
            filters.add(filter);
        }
        String title = "Choose a file with command line arguments";
        File argFile = AFileChooser.askForFile(filters, acceptAll, title, ARGFILE_PATH_PREFERENCE_KEY, true, false, false);
        if (null == argFile) {
View Full Code Here

        TaskStarter() {
            AFileChooser fileChooser;
            fileChooser = new AFileChooser((java.awt.Frame) null, true, LAST_TASK_PATH_KEY);
            fileChooser.setDialogTitle("Start task");
            FileNameExtensionFilter filter = new FileNameExtensionFilter("all jar files", "jar");
            fileChooser.addChoosableFileFilter(filter);
            filter = new FileNameExtensionFilter("smart card task files", "scardtask");
            fileChooser.addChoosableFileFilter(filter);
            fileChooser.setAcceptAllFileFilterUsed(true);
            int option = fileChooser.showOpenDialog(null);
            if (option != JFileChooser.APPROVE_OPTION) {
                return;
View Full Code Here

            cl.addArgDef(orReductionArgHandler.argDef);
            cl.addArgDef((new SkipDataScramblingArgHandler()).argDef);
            cl.addArgDef((new SkipAddrScramblingArgHandler()).argDef);
           
            if(0==args.length){
                FileNameExtensionFilter filter = new FileNameExtensionFilter("MemEnc arg files", "MemEnc");
                cl.askForArgFile(filter, true, true, true);
            }else
                cl.addNewArgs(args);
            if(cl.isEmpty()){
                showHelp(cl);
View Full Code Here

    //ask user where to save the data
    File askForFile() {
        AFileChooser fileChooser;//a custom JFileChooser which remembers last location
        fileChooser = new AFileChooser((java.awt.Frame) null, true, LAST_DATA_FILE_PATH_KEY);
        fileChooser.setDialogTitle("Select a file to save random data");
        FileNameExtensionFilter filter = new FileNameExtensionFilter("raw data file", "dat");
        fileChooser.addChoosableFileFilter(filter);
        fileChooser.setAcceptAllFileFilterUsed(true);
        long start = System.nanoTime();
        int option = fileChooser.showOpenDialog(null);
        deadTime += System.nanoTime() - start;
View Full Code Here

TOP

Related Classes of javax.swing.filechooser.FileNameExtensionFilter

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.