Example usage for javax.swing JOptionPane NO_OPTION

List of usage examples for javax.swing JOptionPane NO_OPTION

Introduction

In this page you can find the example usage for javax.swing JOptionPane NO_OPTION.

Prototype

int NO_OPTION

To view the source code for javax.swing JOptionPane NO_OPTION.

Click Source Link

Document

Return value from class method if NO is chosen.

Usage

From source file:JavaMail.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    try {//from  w  w w. j  a v  a  2 s.c  o m
        String from = jTextField1.getText();
        String to = jTextField2.getText();
        String subject = jTextField3.getText();
        String content = jTextArea1.getText();
        Email email = new SimpleEmail();
        String provi = prov.getSelectedItem().toString();
        if (provi.equals("Gmail")) {
            email.setHostName("smtp.gmail.com");
            email.setSmtpPort(465);
            serverlink = "smtp.gmail.com";
            serverport = 465;
        }
        if (provi.equals("Outlook")) {
            email.setHostName("smtp-mail.outlook.com");
            serverlink = "smtp-mail.outlook.com";
            email.setSmtpPort(25);
            serverport = 25;
        }
        if (provi.equals("Yahoo")) {
            email.setHostName("smtp.mail.yahoo.com");
            serverlink = "smtp.mail.yahoo.com";
            email.setSmtpPort(465);
            serverport = 465;
        }
        System.out.println("Initializing email sending sequence");
        System.out.println("Connecting to " + serverlink + " at port " + serverport);
        JPanel panel = new JPanel();
        JLabel label = new JLabel(
                "Enter the password of your email ID to connect with your Email provider." + "\n");
        JPasswordField pass = new JPasswordField(10);
        panel.add(label);
        panel.add(pass);
        String[] options = new String[] { "OK", "Cancel" };
        int option = JOptionPane.showOptionDialog(null, panel, "Enter Email ID Password", JOptionPane.NO_OPTION,
                JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
        if (option == 0) // pressing OK button
        {
            char[] password = pass.getPassword();
            emailpass = new String(password);
        }
        email.setAuthenticator(new DefaultAuthenticator(from, emailpass));
        email.setSSLOnConnect(true);
        if (email.isSSLOnConnect() == true) {
            System.out.println("This server requires SSL/TLS authentication.");
        }
        email.setFrom(from);
        email.setSubject(subject);
        email.setMsg(content);
        email.addTo(to);
        email.send();
        JOptionPane.showMessageDialog(null, "Message sent successfully.");
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:model.settings.ReadSettings.java

/**
 * checks whether program information on current workspace exist.
 * @return if workspace is now set./*www  .  j  a va  2  s.co m*/
 */
public static String install() {
    boolean installed = false;
    String wsLocation = "";
    /*
     * does program root directory exist?
     */
    if (new File(PROGRAM_LOCATION).exists()) {

        //try to read 
        try {
            wsLocation = readFromFile(PROGRAM_SETTINGS_LOCATION);

            installed = new File(wsLocation).exists();
            if (!installed) {
                wsLocation = "";
            }

        } catch (FileNotFoundException e) {
            System.out.println("file not found " + e);
            showErrorMessage();
        } catch (IOException e) {
            System.out.println("io" + e);
            showErrorMessage();
        }
    }

    //if settings not found.
    if (!installed) {

        new File(PROGRAM_LOCATION).mkdir();
        try {

            //create new file chooser
            JFileChooser jc = new JFileChooser();

            //sets the text and language of all the components in JFileChooser
            UIManager.put("FileChooser.openDialogTitleText", "Open");
            UIManager.put("FileChooser.lookInLabelText", "LookIn");
            UIManager.put("FileChooser.openButtonText", "Open");
            UIManager.put("FileChooser.cancelButtonText", "Cancel");
            UIManager.put("FileChooser.fileNameLabelText", "FileName");
            UIManager.put("FileChooser.filesOfTypeLabelText", "TypeFiles");
            UIManager.put("FileChooser.openButtonToolTipText", "OpenSelectedFile");
            UIManager.put("FileChooser.cancelButtonToolTipText", "Cancel");
            UIManager.put("FileChooser.fileNameHeaderText", "FileName");
            UIManager.put("FileChooser.upFolderToolTipText", "UpOneLevel");
            UIManager.put("FileChooser.homeFolderToolTipText", "Desktop");
            UIManager.put("FileChooser.newFolderToolTipText", "CreateNewFolder");
            UIManager.put("FileChooser.listViewButtonToolTipText", "List");
            UIManager.put("FileChooser.newFolderButtonText", "CreateNewFolder");
            UIManager.put("FileChooser.renameFileButtonText", "RenameFile");
            UIManager.put("FileChooser.deleteFileButtonText", "DeleteFile");
            UIManager.put("FileChooser.filterLabelText", "TypeFiles");
            UIManager.put("FileChooser.detailsViewButtonToolTipText", "Details");
            UIManager.put("FileChooser.fileSizeHeaderText", "Size");
            UIManager.put("FileChooser.fileDateHeaderText", "DateModified");
            SwingUtilities.updateComponentTreeUI(jc);

            jc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            jc.setMultiSelectionEnabled(false);

            final String informationMsg = "Please select the workspace folder. \n"
                    + "By default, the new files are saved in there. \n\n"
                    + "Is changed simply by using the Save-As option.\n"
                    + "If no folder is specified, the default worspace folder \n"
                    + "is the home directory of the current user.";
            final int response = JOptionPane.showConfirmDialog(jc, informationMsg, "Select workspace folder",
                    JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE);

            final String defaultSaveLocation = System.getProperty("user.home")
                    + System.getProperty("file.separator");
            File f;
            if (response != JOptionPane.NO_OPTION) {

                //fetch selected file
                f = jc.getSelectedFile();
                jc.showDialog(null, "select");
            } else {
                f = new File(defaultSaveLocation);
            }

            printInformation();

            if (f == null) {
                f = new File(defaultSaveLocation);
            }
            //if file selected
            if (f != null) {

                //if the file exists
                if (f.exists()) {
                    writeToFile(PROGRAM_SETTINGS_LOCATION, ID_PROGRAM_LOCATION + "\n" + f.getAbsolutePath());
                } else {

                    //open message dialog
                    JOptionPane.showConfirmDialog(null, "Folder does " + "not exist",
                            "Error creating workspace", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
                            null);
                }

                //recall install
                return install();
            }

        } catch (IOException e) {
            System.out.println(e);
            JOptionPane.showConfirmDialog(null, "An exception occured." + " Try again later.",
                    "Error creating workspace", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null);
        }
    }

    if (System.getProperty("os.name").equals("Mac OS X")) {

        installOSX();
    } else if (System.getProperty("os.name").equals("Linux")) {
        installLinux();
    } else if (System.getProperty("os.name").equals("Windows")) {
        installWindows();
    }

    return wsLocation;

}

From source file:net.sf.jabref.external.DroppedFileHandler.java

private boolean tryXmpImport(String fileName, ExternalFileType fileType, NamedCompound edits) {

    if (!"pdf".equals(fileType.getExtension())) {
        return false;
    }/*from   www . jav a  2  s.co  m*/

    List<BibEntry> xmpEntriesInFile;
    try {
        xmpEntriesInFile = XMPUtil.readXMP(fileName, Globals.prefs);
    } catch (IOException e) {
        LOGGER.warn("Problem reading XMP", e);
        return false;
    }

    if ((xmpEntriesInFile == null) || xmpEntriesInFile.isEmpty()) {
        return false;
    }

    JLabel confirmationMessage = new JLabel(Localization.lang("The PDF contains one or several BibTeX-records.")
            + "\n"
            + Localization.lang("Do you want to import these as new entries into the current database?"));

    int reply = JOptionPane.showConfirmDialog(frame, confirmationMessage,
            Localization.lang("XMP-metadata found in PDF: %0", fileName), JOptionPane.YES_NO_CANCEL_OPTION,
            JOptionPane.QUESTION_MESSAGE);

    if (reply == JOptionPane.CANCEL_OPTION) {
        return true; // The user canceled thus that we are done.
    }
    if (reply == JOptionPane.NO_OPTION) {
        return false;
    }

    // reply == JOptionPane.YES_OPTION)

    /*
     * TODO Extract Import functionality from ImportMenuItem then we could
     * do:
     *
     * ImportMenuItem importer = new ImportMenuItem(frame, (mainTable ==
     * null), new PdfXmpImporter());
     *
     * importer.automatedImport(new String[] { fileName });
     */

    boolean isSingle = xmpEntriesInFile.size() == 1;
    BibEntry single = isSingle ? xmpEntriesInFile.get(0) : null;

    boolean success = true;

    String destFilename;

    if (linkInPlace.isSelected()) {
        destFilename = FileUtil
                .shortenFileName(new File(fileName), panel.getBibDatabaseContext().getFileDirectory())
                .toString();
    } else {
        if (renameCheckBox.isSelected()) {
            destFilename = fileName;
        } else {
            destFilename = single.getCiteKey() + "." + fileType.getExtension();
        }

        if (copyRadioButton.isSelected()) {
            success = doCopy(fileName, destFilename, edits);
        } else if (moveRadioButton.isSelected()) {
            success = doMove(fileName, destFilename, edits);
        }
    }
    if (success) {

        for (BibEntry aXmpEntriesInFile : xmpEntriesInFile) {

            aXmpEntriesInFile.setId(IdGenerator.next());
            edits.addEdit(new UndoableInsertEntry(panel.getDatabase(), aXmpEntriesInFile, panel));
            panel.getDatabase().insertEntry(aXmpEntriesInFile);
            doLink(aXmpEntriesInFile, fileType, destFilename, true, edits);

        }
        panel.markBaseChanged();
        panel.updateEntryEditorIfShowing();
    }
    return true;
}

From source file:net.sf.jabref.gui.exporter.SaveDatabaseAction.java

private boolean saveDatabase(File file, boolean selectedOnly, Charset encoding) throws SaveException {
    SaveSession session;//from w  w  w  .  j  av  a 2 s  .  co  m
    frame.block();
    try {
        SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs)
                .withEncoding(encoding);
        BibtexDatabaseWriter databaseWriter = new BibtexDatabaseWriter(FileSaveSession::new);
        if (selectedOnly) {
            session = databaseWriter.savePartOfDatabase(panel.getBibDatabaseContext(),
                    panel.getSelectedEntries(), prefs);
        } else {
            session = databaseWriter.saveDatabase(panel.getBibDatabaseContext(), prefs);

        }
        panel.registerUndoableChanges(session);

    } catch (UnsupportedCharsetException ex2) {
        JOptionPane.showMessageDialog(frame,
                Localization.lang("Could not save file.") + Localization
                        .lang("Character encoding '%0' is not supported.", encoding.displayName()),
                Localization.lang("Save database"), JOptionPane.ERROR_MESSAGE);
        throw new SaveException("rt");
    } catch (SaveException ex) {
        if (ex == SaveException.FILE_LOCKED) {
            throw ex;
        }
        if (ex.specificEntry()) {
            // Error occured during processing of
            // be. Highlight it:
            int row = panel.getMainTable().findEntry(ex.getEntry());
            int topShow = Math.max(0, row - 3);
            panel.getMainTable().setRowSelectionInterval(row, row);
            panel.getMainTable().scrollTo(topShow);
            panel.showEntry(ex.getEntry());
        } else {
            LOGGER.error("Problem saving file", ex);
        }

        JOptionPane.showMessageDialog(frame,
                Localization.lang("Could not save file.") + ".\n" + ex.getMessage(),
                Localization.lang("Save database"), JOptionPane.ERROR_MESSAGE);
        throw new SaveException("rt");

    } finally {
        frame.unblock();
    }

    boolean commit = true;
    if (!session.getWriter().couldEncodeAll()) {
        FormBuilder builder = FormBuilder.create()
                .layout(new FormLayout("left:pref, 4dlu, fill:pref", "pref, 4dlu, pref"));
        JTextArea ta = new JTextArea(session.getWriter().getProblemCharacters());
        ta.setEditable(false);
        builder.add(Localization.lang("The chosen encoding '%0' could not encode the following characters:",
                session.getEncoding().displayName())).xy(1, 1);
        builder.add(ta).xy(3, 1);
        builder.add(Localization.lang("What do you want to do?")).xy(1, 3);
        String tryDiff = Localization.lang("Try different encoding");
        int answer = JOptionPane.showOptionDialog(frame, builder.getPanel(), Localization.lang("Save database"),
                JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null,
                new String[] { Localization.lang("Save"), tryDiff, Localization.lang("Cancel") }, tryDiff);

        if (answer == JOptionPane.NO_OPTION) {
            // The user wants to use another encoding.
            Object choice = JOptionPane.showInputDialog(frame, Localization.lang("Select encoding"),
                    Localization.lang("Save database"), JOptionPane.QUESTION_MESSAGE, null,
                    Encodings.ENCODINGS_DISPLAYNAMES, encoding);
            if (choice == null) {
                commit = false;
            } else {
                Charset newEncoding = Charset.forName((String) choice);
                return saveDatabase(file, selectedOnly, newEncoding);
            }
        } else if (answer == JOptionPane.CANCEL_OPTION) {
            commit = false;
        }

    }

    try {
        if (commit) {
            session.commit(file.toPath());
            panel.getBibDatabaseContext().getMetaData().setEncoding(encoding); // Make sure to remember which encoding we used.
        } else {
            session.cancel();
        }
    } catch (SaveException e) {
        int ans = JOptionPane.showConfirmDialog(null,
                Localization.lang("Save failed during backup creation") + ". "
                        + Localization.lang("Save without backup?"),
                Localization.lang("Unable to create backup"), JOptionPane.YES_NO_OPTION);
        if (ans == JOptionPane.YES_OPTION) {
            session.setUseBackup(false);
            session.commit(file.toPath());
            panel.getBibDatabaseContext().getMetaData().setEncoding(encoding);
        } else {
            commit = false;
        }
    }

    return commit;
}

From source file:jhplot.HPlotChart.java

/**
 * Exports the image to some graphic format.
 *//*w  ww.  j  av a 2s. co m*/
protected void exportImage() {

    JFrame jm = getFrame();
    JFileChooser fileChooser = jhplot.gui.CommonGUI.openImageFileChooser(jm);

    if (fileChooser.showDialog(jm, "Save As") == 0) {

        final File scriptFile = fileChooser.getSelectedFile();
        if (scriptFile == null)
            return;
        else if (scriptFile.exists()) {
            int res = JOptionPane.showConfirmDialog(jm, "The file exists. Do you want to overwrite the file?",
                    "", JOptionPane.YES_NO_OPTION);
            if (res == JOptionPane.NO_OPTION)
                return;
        }
        String mess = "write image  file ..";
        JHPlot.showStatusBarText(mess);
        Thread t = new Thread(mess) {
            public void run() {
                export(scriptFile.getAbsolutePath());
            };
        };
        t.start();
    }
}

From source file:edu.ku.brc.specify.config.init.TaxonLoadSetupPanel.java

/**
 * @return//from www. j a  v  a 2 s. co m
 */
@SuppressWarnings("unchecked")
private Vector<TaxonFileDesc> readTaxonLoadFiles() {
    String taxonXML = getTaxonDOMStr();
    while (taxonXML == null || taxonXML.length() < 1024) {
        int rv = UIRegistry.askYesNoLocalized("DWNLD_TRY_AGAIN", "SKIP",
                UIRegistry.getResourceString(BAD_TAXON_DEF_DL), "WARNING");
        if (rv == JOptionPane.NO_OPTION) {
            return null;
        }
        taxonXML = getTaxonDOMStr();
    }

    XStream xstream = new XStream();
    TaxonFileDesc.configXStream(xstream);

    return (Vector<TaxonFileDesc>) xstream.fromXML(taxonXML);
}

From source file:edu.ku.brc.af.auth.UserAndMasterPasswordMgr.java

/**
 * @return Username and Password as a pair
 *//*from   ww  w .j av a2s .  com*/
protected Pair<String, String> getUserNamePasswordInternal() {
    Pair<String, String> noUP = new Pair<String, String>("", "");

    Boolean isLocal = AppPreferences.getLocalPrefs().getBoolean(getIsLocalPrefPath(true), null);
    if (isLocal == null) {
        isLocal = AppPreferences.getLocalPrefs().getBoolean(getIsLocalPrefPath(false), null);
    }

    String masterKey = AppPreferences.getLocalPrefs().get(getMasterPrefPath(true), null);
    if (StringUtils.isEmpty(masterKey)) {
        masterKey = AppPreferences.getLocalPrefs().get(getMasterPrefPath(false), null);
    }

    if (isLocal == null || StringUtils.isEmpty(masterKey)) {
        if (askToContForCredentials() == JOptionPane.NO_OPTION) {
            return null;
        }

        if (!askForInfo(null, null, null, null)) {
            return noUP;//getUserNamePassword();
        }
    }

    if (StringUtils.isNotEmpty(masterKey)) {
        String keyStr = null;
        if (isLocal) {
            try {
                keyStr = Encryption.decrypt(masterKey, usersPassword);
                if (keyStr == null) {
                    return noUP;
                }

            } catch (Exception ex) // catch any exception
            {
                return noUP;
            }

        } else {
            keyStr = getResourceStringFromURL(masterKey, usersUserName, usersPassword);
            if (StringUtils.isNotEmpty(keyStr)) {
                try {
                    keyStr = decrypt(keyStr);

                } catch (Exception ex) // catch any exception
                {
                    return noUP;
                }
            } else {
                return noUP;
            }
        }

        String[] tokens = StringUtils.split(keyStr, ",");
        if (tokens.length == 2) {
            return new Pair<String, String>(tokens[0], tokens[1]);
        }
        return noUP;
    }
    return noUP;

}

From source file:kevin.gvmsgarch.App.java

private static ContactFilter buildFilter() {
    ContactFilter retval = null;/*from   w  w  w.j a v  a  2 s . c o m*/

    int optionPaneResult;

    //        optionPaneResult = JOptionPane.showConfirmDialog(null, "Do you want to enable filtering?", "", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
    String[] options = new String[] { "Yes", "No" };

    optionPaneResult = JOptionPane.showOptionDialog(null, "Do you want to enable filtering?", "",
            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]);

    if (optionPaneResult == 0) {
        JOptionPane.showMessageDialog(null, filterExplanation);
        String contactName = JOptionPane
                .showInputDialog("Filter String (contact display name or phone number)");
        if (contactName == null || contactName.trim().isEmpty()) {
            retval = new NullFilter();
        } else {
            if (contactName.trim().equals("Unknown")) {
                retval = new UnknownFilter();
            } else {
                retval = new NameNumberFilter(contactName);
            }
        }
    } else if (optionPaneResult == JOptionPane.NO_OPTION) {
        retval = new NullFilter();

    }

    return retval;
}

From source file:com.dragoniade.deviantart.deviation.SearchRss.java

private int retrieveTotal(ProgressDialog progress, Collection collection) {
    int offset = collection == null ? 6000 : 480;
    int greaterThan = 0;
    int lessThan = Integer.MAX_VALUE;
    int iteration = 0;
    String searchQuery = search.getSearch().replace("%username%", user);

    while (total < 0) {
        if (progress.isCancelled()) {
            return -1;
        }/*from   w  ww . j av  a 2  s.c o m*/

        progress.setText("Fetching total (" + ++iteration + ")");
        String queryString = "http://backend.deviantart.com/rss.xml?q=" + searchQuery
                + (collection == null ? "" : "/" + collection.getId()) + "&type=deviation&offset=" + offset;
        GetMethod method = new GetMethod(queryString);
        try {
            int sc = -1;
            do {
                sc = client.executeMethod(method);
                if (sc != 200) {
                    LoggableException ex = new LoggableException(method.getResponseBodyAsString());
                    Thread.getDefaultUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), ex);

                    int res = DialogHelper.showConfirmDialog(owner,
                            "An error has occured when contacting deviantART : error " + sc + ". Try again?",
                            "Continue?", JOptionPane.YES_NO_OPTION);
                    if (res == JOptionPane.NO_OPTION) {
                        return -1;
                    }
                }
            } while (sc != 200);

            XmlToolkit toolkit = XmlToolkit.getInstance();

            Element responses = toolkit.parseDocument(method.getResponseBodyAsStream());
            method.releaseConnection();

            List<?> deviations = toolkit.getMultipleNodes(responses, "channel/item");

            HashMap<String, String> prefixes = new HashMap<String, String>();
            prefixes.put("atom", responses.getOwnerDocument().lookupNamespaceURI("atom"));
            Node next = toolkit.getSingleNode(responses, "channel/atom:link[@rel='next']",
                    toolkit.getNamespaceContext(prefixes));
            int size = deviations.size();

            if (debug) {
                System.out.println();
                System.out.println();
                System.out.println("Lesser  Than: " + lessThan);
                System.out.println("Greater Than: " + greaterThan);
                System.out.println("Offset: " + offset);
                System.out.println("Size: " + size);
            }

            if (size != OFFSET && size > 0) {
                if (next != null) {
                    greaterThan = offset + OFFSET;
                } else {
                    if (debug)
                        System.out.println("Total (offset + size) : " + (offset + size));
                    return offset + size;
                }
            }

            // Page is full, there is more deviations
            if (size == OFFSET) {
                greaterThan = offset + OFFSET;
            }

            if (size == 0) {
                lessThan = offset;
            }

            if (greaterThan == lessThan) {
                if (debug)
                    System.out.println("Total (greaterThan) : " + greaterThan);
                return greaterThan;
            }

            if (lessThan == Integer.MAX_VALUE) {
                offset = offset * 2;
            } else {
                offset = (greaterThan + lessThan) / 2;
                if (offset % 60 != 0) {
                    offset = (offset / 60) * 60;
                }
            }

            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
            }
        } catch (IOException e) {
            int res = DialogHelper.showConfirmDialog(owner,
                    "An error has occured when contacting deviantART : error " + e + ". Try again?",
                    "Continue?", JOptionPane.YES_NO_OPTION);
            if (res == JOptionPane.NO_OPTION) {
                return -1;
            }
        }
    }

    return total;

}

From source file:de.tor.tribes.ui.views.DSWorkbenchFormFrame.java

private void copySelectionToInternalClipboardAsBBCodes() {
    try {//from  w ww.j  av  a  2  s .c  o m
        List<AbstractForm> forms = getSelectedForms();
        if (forms.isEmpty()) {
            showInfo("Keine Zeichnungen ausgewhlt");
            return;
        }
        int ignoredForms = 0;
        for (AbstractForm form : forms) {
            if (!form.allowsBBExport()) {
                ignoredForms++;
            }
        }

        boolean extended = (JOptionPaneHelper.showQuestionConfirmBox(this,
                "Erweiterte BB-Codes verwenden (nur fr Forum und Notizen geeignet)?", "Erweiterter BB-Code",
                "Nein", "Ja") == JOptionPane.YES_OPTION);

        StringBuilder buffer = new StringBuilder();
        if (extended) {
            buffer.append("[u][size=12]Zeichnungen[/size][/u]\n\n");
        } else {
            buffer.append("[u]Zeichnungen[/u]\n\n");
        }

        buffer.append(new FormListFormatter().formatElements(forms, extended));

        if (extended) {
            buffer.append("\n[size=8]Erstellt am ");
            buffer.append(
                    new SimpleDateFormat("dd.MM.yy 'um' HH:mm:ss").format(Calendar.getInstance().getTime()));
            buffer.append(" mit DS Workbench ");
            buffer.append(Constants.VERSION).append(Constants.VERSION_ADDITION + "[/size]\n");
        } else {
            buffer.append("\nErstellt am ");
            buffer.append(
                    new SimpleDateFormat("dd.MM.yy 'um' HH:mm:ss").format(Calendar.getInstance().getTime()));
            buffer.append(" mit DS Workbench ");
            buffer.append(Constants.VERSION).append(Constants.VERSION_ADDITION + "\n");
        }

        String b = buffer.toString();
        StringTokenizer t = new StringTokenizer(b, "[");
        int cnt = t.countTokens();
        if (cnt > 1000) {
            if (JOptionPaneHelper.showQuestionConfirmBox(this,
                    "Die ausgewhlten Zeichnungen bentigen mehr als 1000 BB-Codes\n"
                            + "und knnen daher im Spiel (Forum/IGM/Notizen) nicht auf einmal dargestellt werden.\nTrotzdem exportieren?",
                    "Zu viele BB-Codes", "Nein", "Ja") == JOptionPane.NO_OPTION) {
                return;
            }
        }

        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(b), null);
        String result = null;
        if (ignoredForms != forms.size()) {
            result = "<html>Daten in Zwischenablage kopiert.";
            if (ignoredForms > 0) {
                result += ((ignoredForms == 1) ? " Eine Zeichnung wurde"
                        : " " + ignoredForms + " Zeichnungen wurden")
                        + " ignoriert, da der BB-Export nur fr Rechtecke, Kreise und Freihandzeichnungen verf&uuml;gbar ist.";
            }
            result += "</html>";
        } else {
            showError(
                    "<html>Keine Zeichnungen exportiert, da der BB-Export nur fr Rechtecke, Kreise und Freihandzeichnungen verf&uuml;gbar ist.</html>");
            return;
        }
        showSuccess(result);
    } catch (Exception e) {
        logger.error("Failed to copy data to clipboard", e);
        String result = "Fehler beim Kopieren in die Zwischenablage.";
        showError(result);
    }
}