Java Code Examples for javax.swing.JFileChooser#resetChoosableFileFilters()

The following examples show how to use javax.swing.JFileChooser#resetChoosableFileFilters() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
/** Creates a new instance of DirectoryChooser */
public DirectoryEvent(JTextComponent TxtField) {
    m_jTxtField = TxtField;
    m_fc = new JFileChooser();
    
    m_fc.resetChoosableFileFilters();
    m_fc.addChoosableFileFilter(new FileFilter() {
        public boolean accept(File f) {
            if (f.isDirectory()) {
                return true;
            } else {
                String filename = f.getName();
                return filename.endsWith(".jar")
                    || filename.endsWith(".JAR")
                    || filename.endsWith(".zip")
                    || filename.endsWith(".ZIP");
            }
        }
        public String getDescription() {
            return AppLocal.getIntString("filter.dbdriverlib");
        }
    });
    m_fc.setFileSelectionMode(JFileChooser.FILES_ONLY );
}
 
Example 2
Source Project: KEEL   File: ImportPanel.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void outputFormatComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outputFormatComboBoxItemStateChanged

    if (((String) outputFormatComboBox.getSelectedItem()).equals("PropertyList to Keel") || ((String) outputFormatComboBox.getSelectedItem()).equals("Weka to Keel") || ((String) outputFormatComboBox.getSelectedItem()).equals("Keel to Keel")) {
        optionsButton.setEnabled(false);
    } else {
        optionsButton.setEnabled(true);
    }

    if (((String) outputFormatComboBox.getSelectedItem()).equals("CSV to Keel") || ((String) outputFormatComboBox.getSelectedItem()).equals("TXT to Keel") || ((String) outputFormatComboBox.getSelectedItem()).equals("PRN to Keel") || ((String) outputFormatComboBox.getSelectedItem()).equals("Excel to Keel") || ((String) outputFormatComboBox.getSelectedItem()).equals("HTML Tab to Keel")) {
        processHeaderCheckBox.setEnabled(true);
    } else {
        processHeaderCheckBox.setEnabled(false);
    }

    setExtensionAndDescription();
    JFileChooser chooser = fileBrowserPanel.getFileChooser();
    chooser.resetChoosableFileFilters();
    if (ext.equals("DISABLE")) {
        chooser.setFileFilter(null);
        chooser.setVisible(false);
    } else {
        KeelFileFilter fileFilter = new KeelFileFilter();
        fileFilter.addExtension(ext);
        fileFilter.setFilterName(desc);
        chooser.setFileFilter(fileFilter);
        chooser.setVisible(true);
        //fileBrowserPanel.repaint();
    }

    importOptionsDialog = createNewOptionsDialog(((String) outputFormatComboBox.getSelectedItem()));

}
 
Example 3
Source Project: KEEL   File: ImportPanel.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void outputFormatPartitionsComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outputFormatPartitionsComboBoxItemStateChanged
    if (((String) outputFormatPartitionsComboBox.getSelectedItem()).equals("PropertyList to Keel") || ((String) outputFormatPartitionsComboBox.getSelectedItem()).equals("Weka to Keel") || ((String) outputFormatPartitionsComboBox.getSelectedItem()).equals("Keel to Keel")) {
        optionsPartitionsButton.setEnabled(false);
    } else {
        optionsPartitionsButton.setEnabled(true);
    }
    setExtensionAndDescription();


    if (((String) outputFormatPartitionsComboBox.getSelectedItem()).equals("CSV to Keel") || ((String) outputFormatPartitionsComboBox.getSelectedItem()).equals("TXT to Keel") || ((String) outputFormatPartitionsComboBox.getSelectedItem()).equals("PRN to Keel") || ((String) outputFormatPartitionsComboBox.getSelectedItem()).equals("Excel to Keel") || ((String) outputFormatPartitionsComboBox.getSelectedItem()).equals("HTML Tab to Keel")) {
        processHeaderPartitionsCheckBox.setEnabled(true);
    } else {
        processHeaderPartitionsCheckBox.setEnabled(false);
    }

    JFileChooser chooser = fileBrowserPanel1.getFileChooser();
    chooser.resetChoosableFileFilters();

    KeelFileFilter fileFilter = new KeelFileFilter();
    fileFilter.addExtension(ext);
    fileFilter.setFilterName(desc);
    chooser.setFileFilter(fileFilter);

    trainingModel.removeAllElements();
    testingModel.removeAllElements();

    importOptionsDialog = createNewOptionsDialog(((String) outputFormatPartitionsComboBox.getSelectedItem()));
}