Example usage for javax.swing JOptionPane OK_CANCEL_OPTION

List of usage examples for javax.swing JOptionPane OK_CANCEL_OPTION

Introduction

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

Prototype

int OK_CANCEL_OPTION

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

Click Source Link

Document

Type used for showConfirmDialog.

Usage

From source file:fi.hoski.remote.ui.Admin.java

private JMenuItem menuItemBackupEntity() {
    final String title = TextUtil.getText("BACKUP ENTITY");
    JMenuItem backupYearItem = new JMenuItem(title);
    ActionListener backupYearAction = new ActionListener() {

        @Override//  w ww  .ja va2s.c o  m
        public void actionPerformed(ActionEvent e) {
            Object kind = JOptionPane.showInputDialog(frame, title, "", JOptionPane.OK_CANCEL_OPTION, null,
                    serverProperties.getTables(), null);
            if (kind != null) {
                SimpleDateFormat format = new SimpleDateFormat(TSFORMAT);
                String ts = format.format(new Date());
                File file = saveFile(BACKUPDIR, kind + ts + ".ser", ".ser", "Backup");
                if (file != null) {
                    int count;
                    try (FileOutputStream fos = new FileOutputStream(file)) {
                        BufferedOutputStream bos = new BufferedOutputStream(fos);
                        ObjectOutputStream oos = new ObjectOutputStream(bos);
                        List<String> list = new ArrayList<String>();
                        list.add(kind.toString());
                        count = dss.backup(list, oos);
                        JOptionPane.showMessageDialog(frame, TextUtil.getText("STORED") + " " + count);
                    } catch (IOException ex) {
                        ex.printStackTrace();
                        JOptionPane.showMessageDialog(frame, ex.getMessage());
                    }
                }
            }
        }
    };
    backupYearAction = createActionListener(frame, backupYearAction);
    backupYearItem.addActionListener(backupYearAction);
    return backupYearItem;
}

From source file:de.adv_online.aaa.katalogtool.KatalogDialog.java

protected void closeDialog() {
    try {// w w  w . ja  va  2s . co m
        String msg = null;
        if (transformationRunning)
            msg = "Eine Katalogerzeugung luft derzeit.\n";// Meldung

        if (msg != null) {
            msg += "Soll die Anwendung beendet werden?";
            Object[] options = { "Exit", "Cancel" };
            int val = JOptionPane.showOptionDialog(null, msg, "Confirmation", JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.QUESTION_MESSAGE, null, options, options[1]);
            if (val == 1)
                return;
        }

        if (model != null)
            model.shutdown();

        System.exit(0);
    } catch (Exception e) {
        System.out.println("closeDialog - Exception: " + e.toString());
        //System.exit(1);
    }
}

From source file:fi.hoski.remote.ui.Admin.java

private JMenuItem menuItemBackupYear() {
    final String title = TextUtil.getText("BACKUP YEAR");
    JMenuItem backupYearItem = new JMenuItem(title);
    ActionListener backupYearAction = new ActionListener() {

        @Override//ww w .j ava 2s  .co m
        public void actionPerformed(ActionEvent e) {
            Object yearString = JOptionPane.showInputDialog(frame, title, "", JOptionPane.OK_CANCEL_OPTION);
            if (yearString != null) {
                long year = Long.parseLong(yearString.toString());
                File file = saveFile(BACKUPDIR, year + ".ser", ".ser", "Backup");
                if (file != null) {
                    int count;
                    try (FileOutputStream fos = new FileOutputStream(file)) {
                        BufferedOutputStream bos = new BufferedOutputStream(fos);
                        ObjectOutputStream oos = new ObjectOutputStream(bos);
                        count = dss.backup(year, oos);
                        JOptionPane.showMessageDialog(frame, TextUtil.getText("STORED") + " " + count);
                    } catch (IOException ex) {
                        ex.printStackTrace();
                        JOptionPane.showMessageDialog(frame, ex.getMessage());
                    }
                }
            }
        }
    };
    backupYearAction = createActionListener(frame, backupYearAction);
    backupYearItem.addActionListener(backupYearAction);
    return backupYearItem;
}

From source file:Interfaz.rubiktimer.java

public void cerrar() {
    try {//w ww .j a va2  s . co m
        this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent w) {

                int valor = JOptionPane.showConfirmDialog(null,
                        "Esta Seguro de cerrar la aplicacion?\nNota:  Asegurese de haber guardado los tiempos obtenidos ",
                        "Cerrar Rubik Cube Timer", JOptionPane.OK_CANCEL_OPTION);
                if (valor == JOptionPane.OK_OPTION) {
                    JOptionPane.showMessageDialog(null, "Gracias por usar Rubik Cube Timer", "Gracias",
                            JOptionPane.INFORMATION_MESSAGE);
                    System.exit(0);
                } else if (valor == JOptionPane.CANCEL_OPTION) {
                    System.out.println("Cnacelar Operacion de cerrar");
                }
            }
        });
        this.setVisible(true);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:be.agiv.security.demo.Main.java

private void invokeClaimsAwareService() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    JPanel contentPanel = new JPanel(gridBagLayout);

    final JLabel ipStsLabel = new JLabel("IP-STS:");
    gridBagConstraints.gridx = 0;/*from w  w  w .  j a va2 s.c  o m*/
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = GridBagConstraints.WEST;
    gridBagConstraints.ipadx = 5;
    gridBagLayout.setConstraints(ipStsLabel, gridBagConstraints);
    contentPanel.add(ipStsLabel);

    final JTextField ipStsTextField = new JTextField(
            "https://auth.beta.agiv.be/ipsts/Services/DaliSecurityTokenServiceConfiguration.svc/IWSTrust13",
            60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(ipStsTextField, gridBagConstraints);
    contentPanel.add(ipStsTextField);

    JLabel realmLabel = new JLabel("Realm:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(realmLabel, gridBagConstraints);
    contentPanel.add(realmLabel);

    JTextField realmTextField = new JTextField(AGIVSecurity.BETA_REALM, 30);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(realmTextField, gridBagConstraints);
    contentPanel.add(realmTextField);

    final CredentialPanel credentialPanel = new CredentialPanel();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(credentialPanel, gridBagConstraints);
    contentPanel.add(credentialPanel);

    final JLabel rStsLabel = new JLabel("R-STS:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = 1;
    gridBagLayout.setConstraints(rStsLabel, gridBagConstraints);
    contentPanel.add(rStsLabel);

    final JTextField rStsTextField = new JTextField(
            "https://auth.beta.agiv.be/sts/Services/SalvadorSecurityTokenServiceConfiguration.svc/IWSTrust13",
            60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(rStsTextField, gridBagConstraints);
    contentPanel.add(rStsTextField);

    JLabel serviceRealmLabel = new JLabel("Service realm:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(serviceRealmLabel, gridBagConstraints);
    contentPanel.add(serviceRealmLabel);

    JTextField serviceRealmTextField = new JTextField(ClaimsAwareServiceFactory.SERVICE_REALM, 60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(serviceRealmTextField, gridBagConstraints);
    contentPanel.add(serviceRealmTextField);

    JLabel urlLabel = new JLabel("Service URL:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(urlLabel, gridBagConstraints);
    contentPanel.add(urlLabel);

    JTextField urlTextField = new JTextField(ClaimsAwareServiceFactory.SERVICE_LOCATION, 60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(urlTextField, gridBagConstraints);
    contentPanel.add(urlTextField);

    final JCheckBox noWsPolicyCheckBox = new JCheckBox("WSDL without WS-Policy");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(noWsPolicyCheckBox, gridBagConstraints);
    contentPanel.add(noWsPolicyCheckBox);

    final JCheckBox useWsSecureConversationCheckBox = new JCheckBox("Use WS-SecureConversation");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(useWsSecureConversationCheckBox, gridBagConstraints);
    contentPanel.add(useWsSecureConversationCheckBox);

    final JCheckBox usePreviousSecurityCheckBox = new JCheckBox("Use previous AGIV Security");
    final JCheckBox cancelPreviousSecureConversationToken = new JCheckBox("Cancel previous conversation token");
    usePreviousSecurityCheckBox.setEnabled(null != this.agivSecurity);
    cancelPreviousSecureConversationToken.setEnabled(false);
    usePreviousSecurityCheckBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            LOG.debug("use previous security: " + usePreviousSecurityCheckBox.isSelected());
            boolean newSecurity = !usePreviousSecurityCheckBox.isSelected();
            ipStsLabel.setEnabled(newSecurity);
            ipStsTextField.setEditable(newSecurity);
            credentialPanel.setEnabled(newSecurity);
            rStsLabel.setEnabled(newSecurity);
            rStsTextField.setEnabled(newSecurity);
            cancelPreviousSecureConversationToken.setEnabled(!newSecurity);
        }
    });
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(usePreviousSecurityCheckBox, gridBagConstraints);
    contentPanel.add(usePreviousSecurityCheckBox);

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(cancelPreviousSecureConversationToken, gridBagConstraints);
    contentPanel.add(cancelPreviousSecureConversationToken);

    JPanel expiresPanel = new JPanel();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = 2;
    gridBagLayout.setConstraints(expiresPanel, gridBagConstraints);
    contentPanel.add(expiresPanel);

    JLabel expiresLabelLabel = new JLabel("Secure conversation token expires:");
    expiresLabelLabel.setEnabled(null != this.agivSecurity);
    expiresPanel.add(expiresLabelLabel);

    JLabel expiresLabel = new JLabel();
    expiresLabel.setEnabled(null != this.agivSecurity);
    expiresPanel.add(expiresLabel);
    if (null != this.agivSecurity) {
        if (false == this.agivSecurity.getSecureConversationTokens().isEmpty()) {
            SecurityToken secureConversationToken = this.agivSecurity.getSecureConversationTokens().values()
                    .iterator().next();
            expiresLabel.setText(secureConversationToken.getExpires().toString());
        }
    }

    int dialogResult = JOptionPane.showConfirmDialog(this, contentPanel, "Claims Aware Service",
            JOptionPane.OK_CANCEL_OPTION);
    if (dialogResult == JOptionPane.CANCEL_OPTION) {
        return;
    }

    final String location = urlTextField.getText();
    final String serviceRealm = serviceRealmTextField.getText();
    final String ipStsLocation = ipStsTextField.getText();
    final String rStsLocation = rStsTextField.getText();
    final String username = credentialPanel.getUsername();
    final String password = credentialPanel.getPassword();
    final File pkcs12File = credentialPanel.getPKCS12File();
    final String realm = realmTextField.getText();

    ExecutorService executor = Executors.newFixedThreadPool(1);
    FutureTask<ArrayOfClaimInfo> futureTask = new FutureTask<ArrayOfClaimInfo>(
            new Callable<ArrayOfClaimInfo>() {

                public ArrayOfClaimInfo call() throws Exception {
                    Service service;
                    if (noWsPolicyCheckBox.isSelected()) {
                        service = ClaimsAwareServiceFactory.getInstanceNoWSPolicy();
                    } else {
                        service = ClaimsAwareServiceFactory.getInstance();
                    }
                    IService iservice = service.getWS2007FederationHttpBindingIService(new AddressingFeature());
                    BindingProvider bindingProvider = (BindingProvider) iservice;

                    if (false == usePreviousSecurityCheckBox.isSelected()) {
                        if (null != username) {
                            Main.this.agivSecurity = new AGIVSecurity(ipStsLocation, rStsLocation, realm,
                                    username, password);
                        } else {
                            Main.this.agivSecurity = new AGIVSecurity(ipStsLocation, rStsLocation, realm,
                                    pkcs12File, password);
                        }
                        Main.this.agivSecurity.addSTSListener(Main.this);
                        if (Main.this.proxyEnable) {
                            agivSecurity.setProxy(Main.this.proxyHost, Main.this.proxyPort,
                                    Main.this.proxyType);
                        }
                    }
                    if (cancelPreviousSecureConversationToken.isSelected()) {
                        Main.this.agivSecurity.cancelSecureConversationTokens();
                    }
                    Main.this.agivSecurity.enable(bindingProvider, location,
                            useWsSecureConversationCheckBox.isSelected(), serviceRealm);

                    ArrayOfClaimInfo result = iservice.getData(0);
                    return result;
                }
            }) {

        @Override
        protected void done() {
            try {
                ArrayOfClaimInfo result = get();
                List<ClaimInfo> claims = result.getClaimInfo();
                StringBuffer message = new StringBuffer();
                for (ClaimInfo claim : claims) {
                    message.append(claim.getName());
                    message.append(" = ");
                    message.append(claim.getValue());
                    message.append("\n");
                }

                JOptionPane.showMessageDialog(Main.this, message.toString(), "Claims Aware Service Result",
                        JOptionPane.INFORMATION_MESSAGE);
            } catch (final Exception e) {
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {

                        public void run() {
                            Main.this.statusBar.setErrorStatus(e.getMessage());
                        }
                    });
                } catch (Exception e1) {
                }
                showException(e);
            }
        }
    };
    executor.execute(futureTask);
}

From source file:course_generator.param.frmEditCurve.java

/**
 * Duplicate the selected curve//w  ww .  j av a2s.c  om
 * Its new name is requested
 */
private void DuplicateCurve() {
    if (!bEditMode) {
        Old_Paramfile = Paramfile;

        //-- Configuration of the panel
        JPanel panel = new JPanel(new GridLayout(0, 1));
        panel.add(new JLabel(bundle.getString("frmEditCurve.DuplicatePanel.name.text")));
        JTextField tfName = new JTextField("");
        panel.add(tfName);
        int result = JOptionPane.showConfirmDialog(this, panel,
                bundle.getString("frmEditCurve.DuplicatePanel.title"), JOptionPane.OK_CANCEL_OPTION,
                JOptionPane.PLAIN_MESSAGE);
        if ((result == JOptionPane.OK_OPTION) && (!tfName.getText().isEmpty())) {
            if (Utils.FileExist(Utils.GetHomeDir() + "/" + CgConst.CG_DIR + "/" + tfName.getText() + ".par")) {
                JOptionPane.showMessageDialog(this, bundle.getString("frmEditCurve.DuplicatePanel.fileexist"));
                return;
            }
            param.name = tfName.getText();
            Paramfile = param.name;
            param.Save(Utils.GetHomeDir() + "/" + CgConst.CG_DIR + "/" + param.name + ".par");
            ChangeEditStatus();
            RefreshCurveList();
            RefreshView();
        }
    }
}

From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_multicastDemand.java

private static void createMulticastDemandGUI(final NetworkElementType networkElementType,
        final IVisualizationCallback callback) {
    final NetPlan netPlan = callback.getDesign();

    JTextField textFieldIngressNodeId = new JTextField(20);
    JTextField textFieldEgressNodeIds = new JTextField(20);

    JPanel pane = new JPanel();
    pane.add(new JLabel("Ingress node id: "));
    pane.add(textFieldIngressNodeId);/*  w  ww.j a  va  2s .co  m*/
    pane.add(Box.createHorizontalStrut(15));
    pane.add(new JLabel("Egress node ids (space separated): "));
    pane.add(textFieldEgressNodeIds);

    while (true) {
        int result = JOptionPane.showConfirmDialog(null, pane,
                "Please enter multicast demand ingress node and set of egress nodes",
                JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (result != JOptionPane.OK_OPTION)
            return;

        try {
            if (textFieldIngressNodeId.getText().isEmpty())
                throw new Exception("Please, insert the ingress node id");
            if (textFieldEgressNodeIds.getText().isEmpty())
                throw new Exception("Please, insert the set of egress node ids");

            String ingressNodeId_st = textFieldIngressNodeId.getText();
            String egressNodeId_st = textFieldEgressNodeIds.getText();

            final long ingressNode = Long.parseLong(ingressNodeId_st);
            if (netPlan.getNodeFromId(ingressNode) == null)
                throw new Exception("Not a valid ingress node id: " + ingressNodeId_st);
            Set<Node> egressNodes = new HashSet<Node>();
            for (String egressNodeIdString : StringUtils.split(egressNodeId_st)) {
                final long nodeId = Long.parseLong(egressNodeIdString);
                final Node node = netPlan.getNodeFromId(nodeId);
                if (node == null)
                    throw new Exception("Not a valid egress node id: " + egressNodeIdString);
                egressNodes.add(node);
            }
            netPlan.addMulticastDemand(netPlan.getNodeFromId(ingressNode), egressNodes, 0, null);
            callback.getVisualizationState().resetPickedState();
            callback.updateVisualizationAfterChanges(
                    Collections.singleton(NetworkElementType.MULTICAST_DEMAND));
            callback.getUndoRedoNavigationManager().addNetPlanChange();
            break;
        } catch (Throwable ex) {
            ErrorHandling.addErrorOrException(ex, AdvancedJTable_multicastDemand.class);
            ErrorHandling.showErrorDialog("Error adding the multicast demand");
        }
    }
}

From source file:sk.uniza.fri.pds.spotreba.energie.gui.MainGui.java

private int showUniversalInputDialog(final Object params, String title, Dimension d) throws HeadlessException {
    SwingMetawidget metawidget = new SwingMetawidget();
    if (d != null) {
        metawidget.setSize(d);/*w w  w  .  jav  a2s . c  o m*/
        metawidget.setPreferredSize(d);
    }

    MetawidgetUtils.setCommonSettings(metawidget);
    metawidget.setToInspect(params);
    Object[] message = { metawidget };
    int option = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.OK_CANCEL_OPTION);
    return option;
}

From source file:Classes.MainForm.java

public void locationFromInternetLabelMouseClicked(MouseEvent e) {
    try {//from  ww  w.  j  a  v a 2  s.  c om
        if (getLocationFromIP()) {
            this.locationFromInternet.setEnabled(true);
            this.locationFromInternet.setIcon(locationfromInternetIconMain);
            int result = JOptionPane.showConfirmDialog(null,
                    PropertiesHandler.getSingleton().getValue(1049) + " : " + country + "\n"
                            + PropertiesHandler.getSingleton().getValue(1050) + " : " + city + "\n"
                            + PropertiesHandler.getSingleton().getValue(1051) + " : " + longitude + "\n"
                            + PropertiesHandler.getSingleton().getValue(1052) + " : " + latitude + "\n"
                            + PropertiesHandler.getSingleton().getValue(1053) + " : " + timezone,
                    PropertiesHandler.getSingleton().getValue(1049) + "-"
                            + PropertiesHandler.getSingleton().getValue(1050) + "-"
                            + PropertiesHandler.getSingleton().getValue(1051) + "-"
                            + PropertiesHandler.getSingleton().getValue(1052),
                    JOptionPane.OK_CANCEL_OPTION);

            if (result == JOptionPane.OK_OPTION) {
                UserConfig.getSingleton().setCountry(country);
                UserConfig.getSingleton().setCity(city);
                UserConfig.getSingleton().setLongitude(longitude);
                UserConfig.getSingleton().setLatitude(latitude);
                UserConfig.getSingleton().setTimezone(timezone);

                XmlHandler.getSingleton().addUserConfig(UserConfig.getSingleton());

                if (AthanPlayer.STARTED) {//kill AthanPlayer if started
                    AthanPlayer.kill();
                }
                java.awt.EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        try {

                            location.setText(UserConfig.getSingleton().getCountry() + " - "
                                    + UserConfig.getSingleton().getCity());

                            getPrayerTimesHandler().Refresh();

                            switch (getPrayerTimesHandler().getActualPrayerTime()) {//set background
                            case 0:
                                backgroundImage = new ImageIcon(getClass().getResource(duhrBackground))
                                        .getImage();
                                break;
                            case 1:
                                backgroundImage = new ImageIcon(getClass().getResource(shorou9Background))
                                        .getImage();
                                break;
                            case 2:
                                backgroundImage = new ImageIcon(getClass().getResource(fajrBackground))
                                        .getImage();
                                break;
                            case 3:
                                backgroundImage = new ImageIcon(getClass().getResource(ishaaBackground))
                                        .getImage();
                                break;
                            case 4:
                                backgroundImage = new ImageIcon(getClass().getResource(maghribBackground))
                                        .getImage();
                                break;
                            case 5:
                                backgroundImage = new ImageIcon(getClass().getResource(asrBackground))
                                        .getImage();
                                break;
                            default:
                                backgroundImage = new ImageIcon(getClass().getResource(shorou9Background))
                                        .getImage();
                                break;
                            }

                            getMainPanel().setImagePanel(getBackgroundImage());
                            getMainPanel().setActualPrayerTime(getPrayerTimesHandler().getActualPrayerTime());
                            getMainPanel().repaint();

                        } catch (Exception e) {
                            try {
                                JOptionPane.showMessageDialog(null,
                                        PropertiesHandler.getSingleton().getValue(1070),
                                        PropertiesHandler.getSingleton().getValue(1069),
                                        JOptionPane.ERROR_MESSAGE);
                            } catch (Exception e1) {
                            }
                        }
                    }
                });
            } else {
                this.locationFromInternet.setEnabled(true);
                this.locationFromInternet.setIcon(locationfromInternetIconMain);
            }
        } else {
            this.locationFromInternet.setIcon(locationfromInternetIconMain);
            this.locationFromInternet.setEnabled(true);
            JOptionPane.showMessageDialog(null, PropertiesHandler.getSingleton().getValue(1104),
                    PropertiesHandler.getSingleton().getValue(1069), JOptionPane.ERROR_MESSAGE);
        }
    } catch (Exception ex) {
        this.locationFromInternet.setEnabled(true);
        this.locationFromInternet.setIcon(locationfromInternetIconMain);
    }
}

From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java

public void unlinkSelectedServers() {
    final Collection<Server> selectedServers = serverList.getSelectedServers();

    final String unlinkString = "Unlink " + selectedServers.size() + " servers";
    final int result = JOptionPane.showOptionDialog(this,
            "You are about to unlink " + selectedServers.size() + " server(s).\n"
                    + "Unlinked servers are not terminated and will keep running.",
            unlinkString, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null,
            Arrays.asList(unlinkString, "Cancel").toArray(), "Cancel");

    if (result != JOptionPane.OK_OPTION) {
        return;/* w  w w  . j a v a  2  s . co m*/
    }

    for (final Server server : selectedServers) {
        server.unlink();
    }

}