Example usage for javax.swing JOptionPane showConfirmDialog

List of usage examples for javax.swing JOptionPane showConfirmDialog

Introduction

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

Prototype

public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType,
        int messageType) throws HeadlessException 

Source Link

Document

Brings up a dialog where the number of choices is determined by the optionType parameter, where the messageType parameter determines the icon to display.

Usage

From source file:com.frostwire.gui.updates.InstallerUpdater.java

private void showUpdateMessage() {
    GUIMediator.safeInvokeLater(new Runnable() {
        public void run() {
            if (_executableFile == null) {
                return;
            }/* w w w.j a va2s .c om*/

            int result = JOptionPane.showConfirmDialog(null, _updateMessage.getMessageInstallerReady(),
                    I18n.tr("Update"), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE);

            if (result == JOptionPane.YES_OPTION) {
                try {
                    if (OSUtils.isWindows()) {
                        String[] commands = new String[] { "CMD.EXE", "/C", _executableFile.getAbsolutePath() };

                        ProcessBuilder pbuilder = new ProcessBuilder(commands);
                        pbuilder.start();
                    } else if (OSUtils.isLinux() && OSUtils.isUbuntu()) {
                        String[] commands = new String[] { "gdebi-gtk", _executableFile.getAbsolutePath() };

                        ProcessBuilder pbuilder = new ProcessBuilder(commands);
                        pbuilder.start();
                    } else if (OSUtils.isMacOSX()) {
                        String[] mountCommand = new String[] { "hdiutil", "attach",
                                _executableFile.getAbsolutePath() };

                        String[] finderShowCommand = new String[] { "open",
                                "/Volumes/" + FilenameUtils.getBaseName(_executableFile.getName()) };

                        ProcessBuilder pbuilder = new ProcessBuilder(mountCommand);
                        Process mountingProcess = pbuilder.start();

                        mountingProcess.waitFor();

                        pbuilder = new ProcessBuilder(finderShowCommand);
                        pbuilder.start();
                    }

                    GUIMediator.shutdown();
                } catch (Throwable e) {
                    LOG.error("Unable to launch new installer", e);
                }
            }
        }
    });
}

From source file:com.edduarte.protbox.core.registry.PbxFile.java

public void setBackupPolicy(BackupPolicy backupPolicy) {
    if (!backupPolicy.equals(BackupPolicy.Ask)) {
        boolean changeBackupPolicy = true;
        if (snapshotStack.size() > backupPolicy.maxBackupSize) {
            changeBackupPolicy = JOptionPane.showConfirmDialog(null,
                    "The number of stored backup copies have been reduced to " + backupPolicy.maxBackupSize
                            + ", and prior backups above that number will be deleted.\n"
                            + "Are you sure you want to change the backup policy?",
                    "Confirm backup policy change", JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_NO_OPTION;
        }/*www. j  a va 2 s  .c  om*/

        if (changeBackupPolicy) {
            this.backupPolicy = backupPolicy;
            while (snapshotStack.size() > backupPolicy.maxBackupSize) {
                snapshotStack.removeLast();
            }
        }
    } else {
        this.backupPolicy = backupPolicy;
    }
}

From source file:de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.webstart.KgmlEdMain.java

/**
 * Constructs a new instance of the editor.
 *///w  w  w. j av a2s.  c om
public KgmlEdMain(final boolean showMainFrame, String applicationName, String[] args) {
    // URL config,
    final ThreadSafeOptions tso = new ThreadSafeOptions();
    SplashScreenInterface splashScreen = new DBEsplashScreen(applicationName, "", new Runnable() {
        public void run() {
            if (showMainFrame) {
                ClassLoader cl = this.getClass().getClassLoader();
                String path = this.getClass().getPackage().getName().replace('.', '/');
                ImageIcon icon = new ImageIcon(cl.getResource(path + "/ipklogo16x16_5.png"));
                final MainFrame mainFrame = MainFrame.getInstance();
                mainFrame.setIconImage(icon.getImage());

                Thread t = new Thread(new Runnable() {
                    public void run() {
                        long waitTime = 0;
                        long start = System.currentTimeMillis();
                        do {
                            if (ErrorMsg.getAppLoadingStatus() == ApplicationStatus.ADDONS_LOADED)
                                break;
                            try {
                                Thread.sleep(50);
                            } catch (InterruptedException e) {
                            }
                            waitTime = System.currentTimeMillis() - start;
                        } while (waitTime < 2000);
                        SplashScreenInterface ss = (SplashScreenInterface) tso.getParam(0, null);
                        ss.setVisible(false);
                        mainFrame.setVisible(true);
                    }
                }, "wait for add-on initialization");
                t.start();
            }

        }
    });
    tso.setParam(0, splashScreen);

    ClassLoader cl = this.getClass().getClassLoader();
    String path = this.getClass().getPackage().getName().replace('.', '/');
    ImageIcon icon = new ImageIcon(cl.getResource(path + "/ipklogo16x16_5.png"));
    ((DBEsplashScreen) splashScreen).setIconImage(icon.getImage());

    splashScreen.setVisible(true);
    GravistoMainHelper.createApplicationSettingsFolder(splashScreen);
    if (!(new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_accepted")).exists()
            && !(new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_rejected")).exists()) {

        ReleaseInfo.setIsFirstRun(true);

        splashScreen.setVisible(false);
        splashScreen.setText("Request KEGG License Status");
        JOptionPane.showMessageDialog(null, "<html><h3>KEGG License Status Evaluation</h3>" + "While "
                + DBEgravistoHelper.DBE_GRAVISTO_VERSION
                + " is available as a academic research tool at no cost to commercial and non-commercial users, for using<br>"
                + "KEGG related functions, it is necessary for all users to adhere to the KEGG license.<br>"
                + "For using " + DBEgravistoHelper.DBE_GRAVISTO_VERSION
                + " you need also be aware of information about licenses and conditions for<br>"
                + "usage, listed at the program info dialog and the " + DBEgravistoHelper.DBE_GRAVISTO_VERSION
                + " website (" + ReleaseInfo.getAppWebURL() + ").<br><br>"
                + DBEgravistoHelper.DBE_GRAVISTO_VERSION
                + " does not distribute information from KEGG but contains functionality for the online-access to  information from KEGG wesite.<br><br>"
                + "<b>Before these functions are available to you, you should  carefully read the following license information<br>"
                + "and decide if it is legit for you to use the KEGG related program functions. If you choose not to use the KEGG functions<br>"
                + "all other features of this application are still available and fully working.",
                DBEgravistoHelper.DBE_GRAVISTO_VERSION + " Program Features Initialization",
                JOptionPane.INFORMATION_MESSAGE);

        JOptionPane.showMessageDialog(null,
                "<html><h3>KEGG License Status Evaluation</h3>" + MenuItemInfoDialog.getKEGGlibText(),
                DBEgravistoHelper.DBE_GRAVISTO_VERSION + " Program Features Initialization",
                JOptionPane.INFORMATION_MESSAGE);

        int result = JOptionPane.showConfirmDialog(null, "<html><h3>Enable KEGG functions?",
                DBEgravistoHelper.DBE_GRAVISTO_VERSION + " Program Features Initialization",
                JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (result == JOptionPane.YES_OPTION) {
            try {
                new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_accepted").createNewFile();
            } catch (IOException e) {
                ErrorMsg.addErrorMessage(e);
            }
        }
        if (result == JOptionPane.NO_OPTION) {
            try {
                new File(ReleaseInfo.getAppFolderWithFinalSep() + "license_kegg_rejected").createNewFile();
            } catch (IOException e) {
                ErrorMsg.addErrorMessage(e);
            }
        }
        if (result == JOptionPane.CANCEL_OPTION) {
            JOptionPane.showMessageDialog(null, "Startup aborted.",
                    DBEgravistoHelper.DBE_GRAVISTO_VERSION + " Program Features Initialization",
                    JOptionPane.INFORMATION_MESSAGE);
            System.exit(0);
        }
        splashScreen.setVisible(true);
    }

    GravistoMainHelper.initApplicationExt(args, splashScreen, cl, null, null);

}

From source file:gov.nih.nci.nbia.StandaloneDMV3.java

public void launch(List<String> seriesList) {
    checkCompatibility();//w  ww  .ja  va 2  s. c o  m
    if ((seriesList == null) || (seriesList.size() <= 0)) {
        JOptionPane.showMessageDialog(null,
                "This version of Download App requires to have at least one series instance UID in manifest file.");
        System.exit(0);
    } else {
        this.seriesList = seriesList;
        if (seriesList.size() > 9999) {
            int result = JOptionPane.showConfirmDialog(null,
                    "The number of series in manifest file exceeds the maximum 9,999 series threshold. Only the first 9,999 series will be downloaded.",
                    "Threshold Exceeded Notification", JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.INFORMATION_MESSAGE);

            if (result != JOptionPane.OK_OPTION) {
                System.exit(0);
            }
        }

        JFrame f;
        String os = System.getProperty("os.name").toLowerCase();
        if (os.startsWith("mac")) {
            f = showProgressForMac("Loading your data");
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createMainWin();
                    f.setVisible(false);
                    f.dispose();
                }
            });
        } else {
            f = showProgress("Loading your data");
            createMainWin();
            f.setVisible(false);
            f.dispose();
        }
    }
}

From source file:gdt.jgui.entity.procedure.JProcedurePanel.java

/**
 * Get the context menu.//from   w  ww  .j  a v a2s.  c  o  m
 * @return the context menu.
 */
@Override
public JMenu getContextMenu() {
    menu = new JMenu("Context");
    menu.addMenuListener(new MenuListener() {
        @Override
        public void menuSelected(MenuEvent e) {
            menu.removeAll();
            JMenuItem runItem = new JMenuItem("Run");
            runItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    run();
                }
            });
            menu.add(runItem);
            Entigrator entigrator = console.getEntigrator(entihome$);
            Sack procedure = entigrator.getEntityAtKey(entityKey$);
            if (procedure.getElementItem("parameter", "noreset") == null) {
                JMenuItem resetItem = new JMenuItem("Reset");
                resetItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        int response = JOptionPane.showConfirmDialog(console.getContentPanel(),
                                "Reset source to default ?", "Confirm", JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE);
                        if (response == JOptionPane.YES_OPTION)
                            reset();
                    }
                });
                menu.add(resetItem);
            }
            JMenuItem folderItem = new JMenuItem("Open folder");
            folderItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        File file = new File(entihome$ + "/" + entityKey$);
                        Desktop.getDesktop().open(file);
                    } catch (Exception ee) {
                        Logger.getLogger(getClass().getName()).info(ee.toString());
                    }
                }
            });
            menu.add(folderItem);
            try {
                //Entigrator entigrator=console.getEntigrator(entihome$);
                Sack entity = entigrator.getEntityAtKey(entityKey$);
                String template$ = entity.getAttributeAt("template");
                if (template$ != null) {
                    JMenuItem adaptClone = new JMenuItem("Adapt clone");
                    adaptClone.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            try {
                                adaptClone(console, getLocator());
                            } catch (Exception ee) {
                                Logger.getLogger(getClass().getName()).info(ee.toString());
                            }
                        }
                    });
                    menu.add(adaptClone);
                }
            } catch (Exception ee) {
                Logger.getLogger(getClass().getName()).info(ee.toString());
            }
        }

        @Override
        public void menuDeselected(MenuEvent e) {
        }

        @Override
        public void menuCanceled(MenuEvent e) {
        }
    });
    return menu;
}

From source file:com.edduarte.protbox.ui.windows.RestoreFileWindow.java

private RestoreFileWindow(final PReg registry) {
    super();/*w w w . ja  va2  s  .  co m*/
    setLayout(null);

    final JTextField searchField = new JTextField();
    searchField.setLayout(null);
    searchField.setBounds(2, 2, 301, 26);
    searchField.setBorder(new LineBorder(Color.lightGray));
    searchField.setFont(Constants.FONT);
    add(searchField);

    final JLabel noBackupFilesLabel = new JLabel("<html>No backups files were found!<br><br>"
            + "<font color=\"gray\">If you think there is a problem with the<br>"
            + "backup system, please create an issue here:<br>"
            + "<a href=\"#\">https://github.com/com.edduarte/protbox/issues</a></font></html>");
    noBackupFilesLabel.setLayout(null);
    noBackupFilesLabel.setBounds(20, 50, 300, 300);
    noBackupFilesLabel.setFont(Constants.FONT.deriveFont(14f));
    noBackupFilesLabel.addMouseListener((OnMouseClick) e -> {
        String urlPath = "https://github.com/com.edduarte/protbox/issues";

        try {

            if (Desktop.isDesktopSupported()) {
                Desktop.getDesktop().browse(new URI(urlPath));

            } else {
                if (SystemUtils.IS_OS_WINDOWS) {
                    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + urlPath);

                } else {
                    java.util.List<String> browsers = Lists.newArrayList("firefox", "opera", "safari",
                            "mozilla", "chrome");

                    for (String browser : browsers) {
                        if (Runtime.getRuntime().exec(new String[] { "which", browser }).waitFor() == 0) {

                            Runtime.getRuntime().exec(new String[] { browser, urlPath });
                            break;
                        }
                    }
                }
            }

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    });

    DefaultMutableTreeNode rootTreeNode = registry.buildEntryTree();
    final JTree tree = new JTree(rootTreeNode);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    if (rootTreeNode.getChildCount() == 0) {
        searchField.setEnabled(false);
        add(noBackupFilesLabel);
    }
    expandTree(tree);
    tree.setLayout(null);
    tree.setRootVisible(false);
    tree.setEditable(false);
    tree.setCellRenderer(new SearchableTreeCellRenderer(searchField));
    searchField.addKeyListener((OnKeyReleased) e -> {

        // update and expand tree
        DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
        model.nodeStructureChanged((TreeNode) model.getRoot());
        expandTree(tree);
    });
    final JScrollPane scroll = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll.setBorder(new DropShadowBorder());
    scroll.setBorder(new LineBorder(Color.lightGray));
    scroll.setBounds(2, 30, 334, 360);
    add(scroll);

    JLabel close = new JLabel(new ImageIcon(Constants.getAsset("close.png")));
    close.setLayout(null);
    close.setBounds(312, 7, 18, 18);
    close.setFont(Constants.FONT);
    close.setForeground(Color.gray);
    close.addMouseListener((OnMouseClick) e -> dispose());
    add(close);

    final JLabel permanentDeleteButton = new JLabel(new ImageIcon(Constants.getAsset("permanent.png")));
    permanentDeleteButton.setLayout(null);
    permanentDeleteButton.setBounds(91, 390, 40, 39);
    permanentDeleteButton.setBackground(Color.black);
    permanentDeleteButton.setEnabled(false);
    permanentDeleteButton.addMouseListener((OnMouseClick) e -> {
        if (permanentDeleteButton.isEnabled()) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            PbxEntry entry = (PbxEntry) node.getUserObject();

            if (JOptionPane.showConfirmDialog(null,
                    "Are you sure you wish to permanently delete '" + entry.realName()
                            + "'?\nThis file and its "
                            + "backup copies will be deleted immediately. You cannot undo this action.",
                    "Confirm Cancel", JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {

                registry.permanentDelete(entry);
                dispose();
                RestoreFileWindow.getInstance(registry);

            } else {
                setVisible(true);
            }
        }
    });
    add(permanentDeleteButton);

    final JLabel configBackupsButton = new JLabel(new ImageIcon(Constants.getAsset("config.png")));
    configBackupsButton.setLayout(null);
    configBackupsButton.setBounds(134, 390, 40, 39);
    configBackupsButton.setBackground(Color.black);
    configBackupsButton.setEnabled(false);
    configBackupsButton.addMouseListener((OnMouseClick) e -> {
        if (configBackupsButton.isEnabled()) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            PbxEntry entry = (PbxEntry) node.getUserObject();
            if (entry instanceof PbxFile) {
                PbxFile pbxFile = (PbxFile) entry;

                JFrame frame = new JFrame("Choose backup policy");
                Object option = JOptionPane.showInputDialog(frame,
                        "Choose below the backup policy for this file:", "Choose backup",
                        JOptionPane.QUESTION_MESSAGE, null, PbxFile.BackupPolicy.values(),
                        pbxFile.getBackupPolicy());

                if (option == null) {
                    setVisible(true);
                    return;
                }
                PbxFile.BackupPolicy pickedPolicy = PbxFile.BackupPolicy.valueOf(option.toString());
                pbxFile.setBackupPolicy(pickedPolicy);
            }
            setVisible(true);
        }
    });
    add(configBackupsButton);

    final JLabel restoreBackupButton = new JLabel(new ImageIcon(Constants.getAsset("restore.png")));
    restoreBackupButton.setLayout(null);
    restoreBackupButton.setBounds(3, 390, 85, 39);
    restoreBackupButton.setBackground(Color.black);
    restoreBackupButton.setEnabled(false);
    restoreBackupButton.addMouseListener((OnMouseClick) e -> {
        if (restoreBackupButton.isEnabled()) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            PbxEntry entry = (PbxEntry) node.getUserObject();
            if (entry instanceof PbxFolder) {
                registry.restoreFolderFromEntry((PbxFolder) entry);

            } else if (entry instanceof PbxFile) {
                PbxFile pbxFile = (PbxFile) entry;
                java.util.List<String> snapshots = pbxFile.snapshotsToString();
                if (snapshots.isEmpty()) {
                    setVisible(true);
                    return;
                }

                JFrame frame = new JFrame("Choose backup");
                Object option = JOptionPane.showInputDialog(frame,
                        "Choose below what backup snapshot would you like restore:", "Choose backup",
                        JOptionPane.QUESTION_MESSAGE, null, snapshots.toArray(), snapshots.get(0));

                if (option == null) {
                    setVisible(true);
                    return;
                }
                int pickedIndex = snapshots.indexOf(option.toString());
                registry.restoreFileFromEntry((PbxFile) entry, pickedIndex);
            }
            dispose();
        }
    });
    add(restoreBackupButton);

    tree.addMouseListener((OnMouseClick) e -> {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
        if (node != null) {
            PbxEntry entry = (PbxEntry) node.getUserObject();
            if ((entry instanceof PbxFolder && entry.areNativeFilesDeleted())) {
                permanentDeleteButton.setEnabled(true);
                restoreBackupButton.setEnabled(true);
                configBackupsButton.setEnabled(false);

            } else if (entry instanceof PbxFile) {
                permanentDeleteButton.setEnabled(true);
                restoreBackupButton.setEnabled(true);
                configBackupsButton.setEnabled(true);

            } else {
                permanentDeleteButton.setEnabled(false);
                restoreBackupButton.setEnabled(false);
                configBackupsButton.setEnabled(false);
            }
        }
    });

    final JLabel cancel = new JLabel(new ImageIcon(Constants.getAsset("cancel.png")));
    cancel.setLayout(null);
    cancel.setBounds(229, 390, 122, 39);
    cancel.setBackground(Color.black);
    cancel.addMouseListener((OnMouseClick) e -> dispose());
    add(cancel);

    addWindowFocusListener(new WindowFocusListener() {
        private boolean gained = false;

        @Override
        public void windowGainedFocus(WindowEvent e) {
            gained = true;
        }

        @Override
        public void windowLostFocus(WindowEvent e) {
            if (gained) {
                dispose();
            }
        }
    });

    setSize(340, 432);
    setUndecorated(true);
    getContentPane().setBackground(Color.white);
    setResizable(false);
    getRootPane().setBorder(BorderFactory.createLineBorder(new Color(100, 100, 100)));
    Utils.setComponentLocationOnCenter(this);
    setVisible(true);
}

From source file:com.diversityarrays.kdxplore.trials.SampleGroupExportDialog.java

static public Set<Integer> getExcludedTraitIds(Component comp, String msgTitle, KdxploreDatabase kdxdb,
        SampleGroup sg) {//from ww  w .  j a  v  a2s . com
    Set<Integer> excludeTheseTraitIds = new HashSet<>();

    try {
        Set<Integer> traitIds = collectTraitIdsFromSamples(kdxdb, sg);
        List<Trait> undecidableTraits = new ArrayList<>();
        Set<Integer> missingTraitIds = new TreeSet<>();
        Map<Integer, Trait> traitMap = kdxdb.getKDXploreKSmartDatabase().getTraitMap();
        for (Integer traitId : traitIds) {
            Trait t = traitMap.get(traitId);
            if (t == null) {
                missingTraitIds.add(traitId);
            } else if (TraitLevel.UNDECIDABLE == t.getTraitLevel()) {
                undecidableTraits.add(t);
            }
        }

        if (!missingTraitIds.isEmpty()) {
            String msg = missingTraitIds.stream().map(i -> Integer.toString(i))
                    .collect(Collectors.joining(","));
            MsgBox.error(comp, msg, "Missing Trait IDs");
            return null;
        }

        if (!undecidableTraits.isEmpty()) {
            String msg = undecidableTraits.stream().map(Trait::getTraitName)
                    .collect(Collectors.joining("\n", "Traits that are neither Plot nor Sub-Plot:\n",
                            "\nDo you want to continue and Exclude samples for those Traits?"));

            if (JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog(comp, msg, msgTitle,
                    JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)) {
                return null;
            }

            Set<Integer> tmp = undecidableTraits.stream().map(Trait::getTraitId).collect(Collectors.toSet());

            excludeTheseTraitIds.addAll(tmp);
        }
    } catch (IOException e) {
        MsgBox.error(comp, "Unable to read samples from database\n" + e.getMessage(), msgTitle);
        return null;
    }

    return excludeTheseTraitIds;
}

From source file:de.fhg.igd.mapviewer.server.file.FileTiler.java

/**
 * Load the command paths from the preferences or ask the user for them
 *///  w w w .j  a  v a  2s  .co  m
private void loadCommandPaths() {
    String convert = pref.get(PREF_CONVERT, null);
    String identify = pref.get(PREF_IDENTIFY, null);

    JFileChooser commandChooser = new JFileChooser();

    if (convert != null && identify != null) {
        if (JOptionPane.showConfirmDialog(null,
                "<html>Found paths to executables:<br/><b>" + convert + "<br/>" + identify
                        + "</b><br/>Do you want to use this settings?</html>",
                "Paths to executables", JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE) == JOptionPane.NO_OPTION) {
            convert = null;
            identify = null;
        }
    }

    if (convert == null) {
        // ask for convert path
        convert = askForPath(commandChooser, new ContainsFileFilter("convert"),
                "Please select your convert executable");
    }

    if (convert != null && identify == null) {
        // ask for identify path
        identify = askForPath(commandChooser, new ContainsFileFilter("identify"),
                "Please select your identify executable");
    }

    if (convert == null)
        pref.remove(PREF_CONVERT);
    else
        pref.put(PREF_CONVERT, convert);

    if (identify == null)
        pref.remove(PREF_IDENTIFY);
    else
        pref.put(PREF_IDENTIFY, identify);

    convertPath = convert;
    identifyPath = identify;
}

From source file:com.vsquaresystem.safedeals.readyreckoner.ReadyReckonerService.java

public Boolean checkExistingDataa() throws IOException {
    logger.info("check ke andar hai bhai??");
    Vector checkCellVectorHolder = read();
    logger.info("checkCellVectorHolder line116 :{}", checkCellVectorHolder);
    logger.info("read in check line117 :{}", read());
    int excelSize = checkCellVectorHolder.size() - 1;
    System.out.println("excelSize" + excelSize);
    List<Readyreckoner> rs = readyReckonerDAL.getAll();
    JFrame parent = new JFrame();

    System.out.println("rs" + rs);
    int listSize = rs.size();
    logger.info("rsss:::::", listSize);
    System.out.println("rsss:::::" + listSize);
    if (excelSize == listSize || excelSize > listSize) {
        JDialog.setDefaultLookAndFeelDecorated(true);
        int response = JOptionPane.showConfirmDialog(null, "Do you want to continue?", "Confirm",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        switch (response) {
        case JOptionPane.NO_OPTION:
            System.out.println("No button clicked");
            JOptionPane.showMessageDialog(parent, "upload Cancelled");
            break;
        case JOptionPane.YES_NO_OPTION:
            saveToDatabase(checkCellVectorHolder);
            System.out.println("Yes button clicked");
            JOptionPane.showMessageDialog(parent, "Saved succesfully");
            break;
        case JOptionPane.CLOSED_OPTION:
            System.out.println("JOptionPane closed");
            break;
        }//from   ww  w .ja v  a2  s .  c om

    } else {
        System.out.println("No selected");
    }

    return true;
}

From source file:de.juwimm.cms.gui.admin.PanUnitGroupPerUser.java

public void unload() {
    if (unitPickData.isModified() || groupPickData.isModified()) {
        int i = JOptionPane.showConfirmDialog(this, rb.getString("dialog.wantToSave"), "CMS",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (i == JOptionPane.YES_OPTION) {
            saveChanges(currentSelected);
        }//w w w .  ja  va2 s. co m
        unitPickData.setModified(false);
        groupPickData.setModified(false);
    }
}