Examples of Chooser


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

            JMenuItem open = new JMenuItem(survey.getStrings().getOpenString());
            open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
            open.setMnemonic(KeyEvent.VK_O);
            open.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    Chooser chooser = new Chooser();
                    chooser.addChoosableFileFilter(new FileNameExtensionFilter("XML Files", "xml"));
                    if (chooser.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION) {
                        try {
                            survey.loadXMLAnswers(chooser.getSelectedFile().getAbsolutePath());
                        } catch (IOException e) {
                            //TODO: i18n this error message
                            JOptionPane.showMessageDialog(frame, e.getMessage(), survey.getTitle(), JOptionPane.ERROR_MESSAGE);
                            throw new RuntimeException(e);
                        } catch (SAXException e) {
View Full Code Here

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

        setAnswer(chooser.getSelectedFile().getAbsolutePath());
    }

    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())) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.