Package org.jsurveylib.gui.swing.widget

Examples of org.jsurveylib.gui.swing.widget.WarnIfExistsChooser


    public ChooserUtil () {

    }
   
    public static void saveSurveyChooser(JFrame frame, Survey survey) {
        WarnIfExistsChooser chooser = new WarnIfExistsChooser() {
            protected String currentFileFilterExtension() {
                //if the file filter is "All Files", WarnIfExistsChooser won't use this value
                return "xml";
            }
        };
        chooser.addChoosableFileFilter(new FileNameExtensionFilter("XML Files", "xml"));
        if (chooser.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) {
            try {
                survey.saveXMLAnswers(chooser.getSelectedFile().getAbsolutePath());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
View Full Code Here


    private JFileChooser getChooser() {
        if (type.isOpenDialog()) {
            return new Chooser(type.getOpenTo());
        } else {
            return new WarnIfExistsChooser(type.getOpenTo()) {
                protected String currentFileFilterExtension() {
                    for (FileFilter fileFilter : type.getFileFilters()) {
                        if (fileFilter.getDescription().equals(this.getFileFilter().getDescription())) {
                            return fileFilter.getExtension().split(",")[0];
                        }
View Full Code Here

TOP

Related Classes of org.jsurveylib.gui.swing.widget.WarnIfExistsChooser

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.