Package misc

Examples of misc.CustomFileFilter


   * chooseExportFile asks the user to choose his export file path
   * The choice is limited by the dynamic extension filter
   */
  private void chooseExportFile() {
    JFileChooser fileChooser = new JFileChooser(Application.settings.getLastPath());
    CustomFileFilter filter = new CustomFileFilter();
    filter.setDescription("*."+(String)exportLanguages.get(jComboBoxLanguage.getSelectedItem()));
    filter.addExtension((String)exportLanguages.get(jComboBoxLanguage.getSelectedItem()));
    fileChooser.setFileFilter(filter);
    if(fileChooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
      String filePath = fileChooser.getSelectedFile().getAbsolutePath();
      // Check on extension
      if (!filePath.toLowerCase().endsWith("."+(String)exportLanguages.get(jComboBoxLanguage.getSelectedItem())))
View Full Code Here


  /**
   * This methods get the file paths for saving and opening files 
   */
  private String getOpenFilePath() {
    JFileChooser fileChooser = new JFileChooser(this.defaultPath);
    CustomFileFilter filter = new CustomFileFilter();
    String tempFilePath = null;
   
    filter.setDescription("*."+fileType);
    filter.addExtension(fileType);
      fileChooser.setFileFilter(filter);
     
    if(fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
      tempFilePath = fileChooser.getSelectedFile().getAbsolutePath();
      //Save the path as the default one
View Full Code Here

    return tempFilePath;
  }
 
  private String getSaveFilePath() {
    JFileChooser fileChooser = new JFileChooser(this.defaultPath);
    CustomFileFilter filter = new CustomFileFilter();
    String tempFilePath = null;
   
    filter.setDescription("*."+fileType);
    filter.addExtension(fileType);
      fileChooser.setFileFilter(filter);
     
    if(fileChooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
      tempFilePath = fileChooser.getSelectedFile().getAbsolutePath();
      //Save the path as the default one
View Full Code Here

TOP

Related Classes of misc.CustomFileFilter

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.