Example usage for javax.swing JOptionPane QUESTION_MESSAGE

List of usage examples for javax.swing JOptionPane QUESTION_MESSAGE

Introduction

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

Prototype

int QUESTION_MESSAGE

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

Click Source Link

Document

Used for questions.

Usage

From source file:ru.apertum.qsystem.client.forms.FAdmin.java

@Action
    public void changePriority() {
        final String num = (String) JOptionPane.showInputDialog(this,
                getLocaleMessage("admin.action.change_priority.num.message"),
                getLocaleMessage("admin.action.change_priority.num.title"), 3, null, null, "");
        if (num != null) {
            final String name = (String) JOptionPane.showInputDialog(this,
                    getLocaleMessage("admin.action.change_priority.get.message"),
                    getLocaleMessage("admin.action.change_priority.get.title"), JOptionPane.QUESTION_MESSAGE, null,
                    Uses.get_PRIORITYS_WORD().values().toArray(), Uses.get_PRIORITYS_WORD().values().toArray()[1]);
            //?  ,  
            if (name != null) {
                for (int i = 0; i < Uses.get_PRIORITYS_WORD().size(); i++) {
                    if (name.equals(Uses.get_PRIORITYS_WORD().get(i))) {
                        JOptionPane.showMessageDialog(this,
                                NetCommander.setCustomerPriority(new ServerNetProperty(), i, num),
                                getLocaleMessage("admin.action.change_priority.title"),
                                JOptionPane.INFORMATION_MESSAGE);

                    }/*www  . j  av  a 2s.c  om*/
                }
            }
        }
    }

From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java

private void printTicketGeneric(String sresourcename, RetailTicketInfo ticket, Object ticketext) {
    java.util.List<TicketLineConstructor> allLines = null;
    java.util.List<TicketLineConstructor> startallLines = new ArrayList<TicketLineConstructor>();
    int count = 0;
    com.openbravo.pos.printer.printer.ImageBillPrinter printer = new ImageBillPrinter();
    if (sresourcename.equals("Printer.Bill")) {
        allLines = getAllLines(ticket, ticketext);

    } else if (sresourcename.equals("Printer.NonChargableBill")) {
        allLines = getNonChargeableLines(ticket, ticketext);
    }/*  ww  w .j av  a 2s  .com*/
    //try {
    //printer.print(allLines);
    //        try {
    int divideLines = allLines.size() / 48;
    int remainder = allLines.size() % 48;
    System.out.println("divideLines---" + divideLines + "--" + remainder);
    int value = 48;
    int k = 0;
    if (divideLines > 0) {
        for (int i = 0; i < divideLines; i++) {
            for (int j = k; j < value; j++) {

                startallLines.add(new TicketLineConstructor(allLines.get(j).getLine()));
                System.out.println("allLines.get(j).getLine()--" + allLines.get(j).getLine());
            }
            try {
                printer.print(startallLines);
            } catch (PrinterException ex) {
                Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex);
            }
            if (allLines.size() > 48) {
                try {
                    Thread.sleep(5000);
                } catch (InterruptedException ex) {
                    Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex);
                }
                int res = JOptionPane.showConfirmDialog(this,
                        AppLocal.getIntString("message.wannaPrintcontinue"),
                        AppLocal.getIntString("message.title"), JOptionPane.OK_OPTION,
                        JOptionPane.QUESTION_MESSAGE);
                if (res == JOptionPane.OK_OPTION) {
                    k = value;
                    value = value + 48;
                    startallLines = new ArrayList<TicketLineConstructor>();
                    System.out.println("startallLinest--" + startallLines.size());
                    startallLines.clear();
                } else {
                    break;
                }
            }

        }
    }
    System.out.println("value---" + value + k + "--" + remainder);
    if (remainder > 0) {
        startallLines = new ArrayList<TicketLineConstructor>();
        System.out.println("startallLinest--" + startallLines.size());
        startallLines.clear();
        for (int m = k; m < k + remainder; m++) {

            startallLines.add(new TicketLineConstructor(allLines.get(m).getLine()));
            System.out.println("allLines.get(j).getLine()--" + allLines.get(m).getLine());
        }
        try {
            printer.print(startallLines);
        } catch (PrinterException ex) {
            Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    //                        try {
    //                            printer.print(allLines);
    //
    //                        } catch (PrinterException ex) {
    //                            Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex);
    //                        }
}

From source file:ru.apertum.qsystem.client.forms.FAdmin.java

@Action
    public void setDisableService() {
        final TreePath selectedPath = treeServices.getSelectionPath();
        if (selectedPath != null) {
            final QService service = (QService) selectedPath.getLastPathComponent();
            final String name = (String) JOptionPane.showInputDialog(this,
                    getLocaleMessage("admin.select_ability.message") + " \"" + service.getName() + "\"",
                    getLocaleMessage("admin.select_ability.title"), JOptionPane.QUESTION_MESSAGE, null,
                    new String[] { getLocaleMessage("admin.service_ability.yes"),
                            getLocaleMessage("admin.service_ability.no") },
                    null);// w w  w . ja v  a 2  s  . c  o m
            //?  ,  
            if (name != null) {
                if (name.equalsIgnoreCase(getLocaleMessage("admin.service_ability.yes"))) {
                    NetCommander.changeTempAvailableService(new ServerNetProperty(), service.getId(), "");
                } else {
                    final String mess = (String) JOptionPane.showInputDialog(this,
                            getLocaleMessage("admin.ability.enter_reason"),
                            getLocaleMessage("admin.select_ability.title"), JOptionPane.QUESTION_MESSAGE);
                    if (mess != null) {
                        NetCommander.changeTempAvailableService(new ServerNetProperty(), service.getId(), mess);
                    } else {
                        return;
                    }
                }
                JOptionPane.showMessageDialog(this,
                        getLocaleMessage("admin.select_ability.message") + " " + service.getName() + " \"" + name
                                + "\"",
                        getLocaleMessage("admin.select_ability.title"), JOptionPane.INFORMATION_MESSAGE);
            }
        }
    }

From source file:src.gui.ItSIMPLE.java

/**
 * @return Returns the planAnalysisFramePanel.
 *//*  w  w w . j av  a  2  s.com*/
private ItFramePanel getPlanAnalysisFramePanel() {
    if (planAnalysisFramePanel == null) {
        planAnalysisFramePanel = new ItFramePanel(":: Plan Analysis", ItFramePanel.NO_MINIMIZE_MAXIMIZE);

        // tool bar
        JToolBar chartsToolBar = new JToolBar();
        chartsToolBar.add(new JButton(drawChartAction));

        // charts panel
        chartsPanel = new JPanel();
        chartsPanel.setLayout(new BoxLayout(chartsPanel, BoxLayout.Y_AXIS));

        ItFramePanel variableSelectionPanel = new ItFramePanel(".: Select variables to be tracked",
                ItFramePanel.NO_MINIMIZE_MAXIMIZE);
        //variableSelectionPanel.setBackground(new Color(151,151,157));

        JSplitPane split = new JSplitPane();
        split.setContinuousLayout(true);
        split.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
        split.setDividerLocation(2 * screenSize.height / 3);

        split.setDividerSize(8);
        //split.setPreferredSize(new Dimension(screenSize.width/4-20, screenSize.height/2 - 50));
        //split.setPreferredSize(new Dimension(screenSize.width/4-20, 120));
        split.setLeftComponent(new JScrollPane(variablesPlanTree));
        split.setRightComponent(new JScrollPane(selectedVariablesPlanTree));

        variableSelectionPanel.setContent(split, false);
        //variableSelectionPanel.setParentSplitPane()

        //JPanel variableSelectionPanel  = new JPanel(new BorderLayout());
        //variableSelectionPanel.add(new JScrollPane(variablesPlanTree), BorderLayout.CENTER);
        //variableSelectionPanel.add(new JScrollPane(selectedVariablesPlanTree), BorderLayout.EAST);

        ItFramePanel variableGraphPanel = new ItFramePanel(".: Chart", ItFramePanel.NO_MINIMIZE_MAXIMIZE);
        variableGraphPanel.setContent(chartsPanel, true);

        JSplitPane mainvariablesplit = new JSplitPane();
        mainvariablesplit.setContinuousLayout(true);
        mainvariablesplit.setOrientation(JSplitPane.VERTICAL_SPLIT);
        mainvariablesplit.setDividerLocation(150);
        mainvariablesplit.setDividerSize(8);
        //mainvariablesplit.setPreferredSize(new Dimension(screenSize.width/4-20, screenSize.height/2 - 50));
        mainvariablesplit.setTopComponent(variableSelectionPanel);
        mainvariablesplit.setBottomComponent(variableGraphPanel);

        // main charts panel - used to locate the tool bar above the charts panel
        JPanel mainChartsPanel = new JPanel(new BorderLayout());
        mainChartsPanel.add(chartsToolBar, BorderLayout.NORTH);
        //mainChartsPanel.add(new JScrollPane(chartsPanel), BorderLayout.CENTER);
        mainChartsPanel.add(mainvariablesplit, BorderLayout.CENTER);

        //Results
        planInfoEditorPane = new JEditorPane();
        planInfoEditorPane.setContentType("text/html");
        planInfoEditorPane.setEditable(false);
        planInfoEditorPane.setCursor(new Cursor(Cursor.TEXT_CURSOR));
        planInfoEditorPane.setBackground(Color.WHITE);

        JPanel resultsPanel = new JPanel(new BorderLayout());

        JToolBar resultsToolBar = new JToolBar();
        resultsToolBar.setRollover(true);

        JButton planReportButton = new JButton("View Full Report",
                new ImageIcon("resources/images/viewreport.png"));
        planReportButton.setToolTipText("<html>View full plan report.<br> For multiple plans you will need "
                + "access to the Internet.<br> The components used in the report require such access (no data is "
                + "sent through the Internet).</html>");
        planReportButton.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //Opens html with defaut browser
                String path = "resources/report/Report.html";
                File report = new File(path);
                path = report.getAbsolutePath();
                try {
                    BrowserLauncher launcher = new BrowserLauncher();
                    launcher.openURLinBrowser("file://" + path);
                } catch (BrowserLaunchingInitializingException ex) {
                    Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex);
                    appendOutputPanelText("ERROR. Problem while trying to open the default browser. \n");
                } catch (UnsupportedOperatingSystemException ex) {
                    Logger.getLogger(ItSIMPLE.class.getName()).log(Level.SEVERE, null, ex);
                    appendOutputPanelText("ERROR. Problem while trying to open the default browser. \n");
                }
            }
        });
        resultsToolBar.add(planReportButton);

        resultsToolBar.addSeparator();
        JButton planReportDataButton = new JButton("Save Report Data",
                new ImageIcon("resources/images/savePDDL.png"));
        planReportDataButton.setToolTipText("<html>Save report data to file</html>");
        planReportDataButton.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //Save report data
                if (solveResult != null) {
                    Element lastOpenFolderElement = itSettings.getChild("generalSettings")
                            .getChild("lastOpenFolder");
                    JFileChooser fc = new JFileChooser(lastOpenFolderElement.getText());
                    fc.setDialogTitle("Save Report Data");
                    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
                    fc.setFileFilter(new XMLFileFilter());

                    int returnVal = fc.showSaveDialog(ItSIMPLE.this);
                    if (returnVal == JFileChooser.APPROVE_OPTION) {
                        File selectedFile = fc.getSelectedFile();
                        String path = selectedFile.getPath();

                        if (!path.toLowerCase().endsWith(".xml")) {
                            path += ".xml";
                        }
                        //save file (xml)
                        try {
                            FileWriter file = new FileWriter(path);
                            file.write(XMLUtilities.toString(solveResult));
                            file.close();
                        } catch (IOException e1) {
                            e1.printStackTrace();
                        }

                        //Save as a last open folder
                        String folder = selectedFile.getParent();
                        //Element lastOpenFolderElement = itSettings.getChild("generalSettings").getChild("lastOpenFolder");
                        lastOpenFolderElement.setText(folder);
                        XMLUtilities.writeToFile("resources/settings/itSettings.xml", itSettings.getDocument());

                        //Ask if the user wants to save plans individually too.
                        boolean needToSavePlans = false;
                        int option = JOptionPane.showOptionDialog(instance,
                                "<html><center>Do you also want to save the plans"
                                        + "<br>in individual files?</center></html>",
                                "Save plans", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
                                null, null);
                        switch (option) {
                        case JOptionPane.YES_OPTION: {
                            needToSavePlans = true;
                        }
                            break;
                        case JOptionPane.NO_OPTION: {
                            needToSavePlans = false;
                        }
                            break;
                        }

                        if (needToSavePlans) {
                            //Close Open tabs
                            List<?> problems = null;
                            try {
                                XPath ppath = new JDOMXPath("project/domains/domain/problems/problem");
                                problems = ppath.selectNodes(solveResult);
                            } catch (JaxenException e2) {
                                e2.printStackTrace();
                            }

                            for (int i = 0; i < problems.size(); i++) {
                                Element problem = (Element) problems.get(i);
                                //create a folder for each problem and put all plans inside as xml files
                                String folderName = problem.getChildText("name");
                                String folderPath = selectedFile.getAbsolutePath()
                                        .replace(selectedFile.getName(), folderName);
                                //System.out.println(folderPath);
                                File planfolder = new File(folderPath);
                                boolean canSavePlan = false;
                                try {
                                    if (planfolder.mkdir()) {
                                        System.out.println("Directory '" + folderPath + "' created.");
                                        canSavePlan = true;
                                    } else {
                                        System.out.println("Directory '" + folderPath + "' was not created.");
                                    }

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

                                if (canSavePlan) {
                                    Element plans = problem.getChild("plans");
                                    for (Iterator<Element> it = plans.getChildren("xmlPlan").iterator(); it
                                            .hasNext();) {
                                        Element eaplan = it.next();
                                        Element theplanner = eaplan.getChild("planner");
                                        //save file (xml)
                                        String planFileName = "solution" + theplanner.getChildText("name") + "-"
                                                + theplanner.getChildText("version") + "-"
                                                + Integer.toString(plans.getChildren().indexOf(eaplan))
                                                + ".xml";
                                        String planPath = folderPath + File.separator + planFileName;
                                        /*
                                        try {
                                            FileWriter planfile = new FileWriter(planPath);
                                            planfile.write(XMLUtilities.toString(eaplan));
                                            planfile.close();
                                            System.out.println("File '" + planPath + "' created.");
                                        } catch (IOException e1) {
                                            e1.printStackTrace();
                                        }
                                        *
                                        */
                                        if (eaplan.getChild("plan").getChildren().size() > 0) {

                                            //TODO: save the plan in PDDL too. It should be done through the XPDDL/PDDL classes
                                            String pddlplan = ToXPDDL.XMLtoXPDDLPlan(eaplan);
                                            String planFileNamePDDL = "solution"
                                                    + theplanner.getChildText("name") + "-"
                                                    + theplanner.getChildText("version") + "-"
                                                    + Integer.toString(plans.getChildren().indexOf(eaplan))
                                                    + ".pddl";
                                            String planPathPDDL = folderPath + File.separator
                                                    + planFileNamePDDL;

                                            //String cfolderPath = selectedFile.getAbsolutePath().replace(selectedFile.getName(), "");
                                            //String planFileNamePDDL = theplanner.getChildText("name")+"-"+theplanner.getChildText("version") + "-" + folderName+"-solution.pddl";
                                            //String planPathPDDL = cfolderPath + File.separator + planFileNamePDDL;
                                            //if (!theplanner.getChildText("name").contains("MIPS")){
                                            try {
                                                FileWriter planfile = new FileWriter(planPathPDDL);
                                                planfile.write(pddlplan);
                                                planfile.close();
                                                System.out.println("File '" + planPathPDDL + "' created.");
                                            } catch (IOException e1) {
                                                e1.printStackTrace();
                                            }
                                        } //}

                                    }

                                }

                            }
                        }

                    }
                } else {
                    appendOutputPanelText(">> No report data available to save! \n");
                }

            }
        });
        resultsToolBar.add(planReportDataButton);

        JButton openPlanReportDataButton = new JButton("Open Report Data",
                new ImageIcon("resources/images/openreport.png"));
        openPlanReportDataButton.setToolTipText("<html>Open report data to file</html>");
        openPlanReportDataButton.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                planSimStatusBar.setText("Status: Opening File...");
                appendOutputPanelText(">> Opening File... \n");
                //Open report data
                Element lastOpenFolderElement = itSettings.getChild("generalSettings")
                        .getChild("lastOpenFolder");
                JFileChooser fc = new JFileChooser(lastOpenFolderElement.getText());
                fc.setDialogTitle("Open Report Data");
                fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
                fc.setFileFilter(new XMLFileFilter());

                int returnVal = fc.showOpenDialog(ItSIMPLE.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {

                    File file = fc.getSelectedFile();
                    // Get itSIMPLE itSettings from itSettings.xml
                    org.jdom.Document resultsDoc = null;
                    try {
                        resultsDoc = XMLUtilities.readFromFile(file.getPath());
                        solveResult = resultsDoc.getRootElement();
                        //XMLUtilities.printXML(solveResult);
                        if (solveResult.getName().equals("projects")) {

                            String report = PlanAnalyzer.generatePlannersComparisonReport(solveResult);
                            String comparisonReport = PlanAnalyzer
                                    .generateFullPlannersComparisonReport(solveResult);
                            //Save Comparison Report file
                            saveFile("resources/report/Report.html", comparisonReport);
                            setPlanInfoPanelText(report);
                            setPlanEvaluationInfoPanelText("");
                            appendOutputPanelText(">> Report data read! \n");

                            //My experiments
                            PlanAnalyzer.myAnalysis(itPlanners.getChild("planners"), solveResult);
                        }
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }

                    //Save as a last open folder
                    String folder = fc.getSelectedFile().getParent();
                    lastOpenFolderElement.setText(folder);
                    XMLUtilities.writeToFile("resources/settings/itSettings.xml", itSettings.getDocument());

                } else {
                    planSimStatusBar.setText("Status:");
                    appendOutputPanelText(">> Canceled \n");
                }

            }
        });
        resultsToolBar.add(openPlanReportDataButton);

        JButton compareProjectReportDataButton = new JButton("Compare Project Data",
                new ImageIcon("resources/images/compare.png"));
        compareProjectReportDataButton.setToolTipText(
                "<html>Compare different project report data <br> This is commonly use to compare diferent domain models with different adjustments.<br>"
                        + "One project data must be chosen as a reference; others will be compared to this referencial one.</html>");
        compareProjectReportDataButton.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {

                final ProjectComparisonDialog dialog = new ProjectComparisonDialog();
                dialog.setVisible(true);

                final List<String> files = dialog.getFiles();

                if (files.size() > 1) {

                    new Thread() {
                        public void run() {
                            appendOutputPanelText(">> Project comparison report requested. Processing... \n");

                            planSimStatusBar.setText("Status: Reading files ...");
                            appendOutputPanelText(">> Reading files ... \n");

                            //base project file
                            String baseFileName = files.get(0);
                            appendOutputPanelText(">> Reading file '" + baseFileName + "' \n");
                            org.jdom.Document baseProjectDoc = null;
                            try {
                                baseProjectDoc = XMLUtilities.readFromFile(baseFileName);
                            } catch (Exception ec) {
                                ec.printStackTrace();
                            }
                            Element baseProject = null;
                            if (baseProjectDoc != null) {
                                baseProject = baseProjectDoc.getRootElement().getChild("project");
                            }

                            //The comparible projects
                            List<Element> comparableProjects = new ArrayList<Element>();

                            for (int i = 1; i < files.size(); i++) {
                                String eafile = files.get(i);
                                appendOutputPanelText(">> Reading file '" + eafile + "' \n");
                                org.jdom.Document eaProjectDoc = null;
                                try {
                                    eaProjectDoc = XMLUtilities.readFromFile(eafile);
                                } catch (Exception ec) {
                                    ec.printStackTrace();
                                }
                                if (eaProjectDoc != null) {
                                    comparableProjects.add(eaProjectDoc.getRootElement().getChild("project"));
                                }

                            }
                            appendOutputPanelText(">> Files read. Building report... \n");

                            String comparisonReport = PlanAnalyzer.generateProjectComparisonReport(baseProject,
                                    comparableProjects);
                            saveFile("resources/report/Report.html", comparisonReport);
                            appendOutputPanelText(
                                    ">> Project comparison report generated. Press 'View Full Report'\n");
                            appendOutputPanelText(" \n");

                        }
                    }.start();

                }

            }
        });
        resultsToolBar.add(compareProjectReportDataButton);

        resultsPanel.add(resultsToolBar, BorderLayout.NORTH);
        resultsPanel.add(new JScrollPane(planInfoEditorPane), BorderLayout.CENTER);

        JTabbedPane planAnalysisTabbedPane = new JTabbedPane();
        planAnalysisTabbedPane.addTab("Results", resultsPanel);
        planAnalysisTabbedPane.addTab("Variable Tracking", mainChartsPanel);
        planAnalysisTabbedPane.addTab("Movie Maker", getMovieMakerPanel());
        planAnalysisTabbedPane.addTab("Plan Evaluation", getPlanEvaluationPanel());
        planAnalysisTabbedPane.addTab("Plan Database", getPlanDatabasePanel());
        planAnalysisTabbedPane.addTab("Rationale Database", getRationaleDatabasePanel());

        JPanel planAnalysisPanel = new JPanel(new BorderLayout());
        //planAnalysisPanel.add(chartsToolBar, BorderLayout.NORTH);
        planAnalysisPanel.add(planAnalysisTabbedPane, BorderLayout.CENTER);
        planAnalysisFramePanel.setContent(planAnalysisPanel, false);

    }

    return planAnalysisFramePanel;
}

From source file:nl.tudelft.goal.SimpleIDE.FilePanel.java

/**
 * Helper method for {@link #handleFileRename(File, File)}. Asks the user
 * which of the given list of file references should be renamed. Returns a
 * new list of nodes that the user has selected. The given list is not
 * altered./*from  www.j a  v  a  2s.  c o  m*/
 */
private List<FileNode> filterFiles(List<FileNode> nodes) {

    ArrayList<FileNode> filteredFiles = new ArrayList<FileNode>();

    // show requester which files to change.
    // we can not dump an array of checkboxes into the showOptionDialog
    // because it will show them next to each oter instead of below each
    // other.
    // and because it does not show the OK and Cancel buttons. So we use
    // ConfirmDialog isntead
    JPanel choicespanel = new JPanel();
    choicespanel.setLayout(new BoxLayout(choicespanel, BoxLayout.Y_AXIS));
    choicespanel.add(new JLabel("There are multiple mas's using the renamed file.\n" //$NON-NLS-1$
            + "Please select which ones have to be renamed")); //$NON-NLS-1$
    ArrayList<JCheckBox> choices = new ArrayList<JCheckBox>();
    for (FileNode n : nodes) {
        JCheckBox checkbox = new JCheckBox("" //$NON-NLS-1$
                + ((FileNode) n.getParent()).getFilename());
        choices.add(checkbox);
        choicespanel.add(checkbox);
    }

    int choice = JOptionPane.showConfirmDialog(this, choicespanel, "Select files to rename", //$NON-NLS-1$
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
    if (choice == JOptionPane.CANCEL_OPTION) {
        return null;
    }
    // and finally copy the requested filenames to array
    for (JCheckBox c : choices) {
        if (c.isSelected()) {
            for (FileNode n : nodes) {
                if (c.getText().equals(((FileNode) n.getParent()).getFilename())) {
                    filteredFiles.add(n);
                    break;
                }
            }
        }
    }

    return filteredFiles;
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

public String getInput(String header, String message) {
    return JOptionPane.showInputDialog(this, message, header, JOptionPane.QUESTION_MESSAGE);
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfigurator.java

public String getInput(final String header, final String message) {
    return JOptionPane.showInputDialog(this, message, header, JOptionPane.QUESTION_MESSAGE);
}

From source file:ome.formats.importer.gui.FileQueueHandler.java

/**
 * Import cancelled dialog/*from w ww.  ja  v  a  2 s.co  m*/
 * 
 * @param frame parent frame
 * @return - true / false if import cancelled
 */
private boolean cancelImportDialog(Component frame) {
    String s1 = "OK";
    String s2 = "Force Quit Now";
    Object[] options = { s1, s2 };
    int n = JOptionPane.showOptionDialog(frame, "Click 'OK' to cancel after the current file has\n"
            + "finished importing, or click 'Force Quit Now' to\n"
            + "force the importer to quit importing immediately.\n\n"
            + "You should only force quit the importer if there\n"
            + "has been an import problem, as this leaves partial\n" + "files in your server dataset.\n\n",
            "Cancel Import", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, s1);
    if (n == JOptionPane.NO_OPTION) {
        return true;
    } else {
        return false;
    }
}

From source file:ome.formats.importer.gui.GuiCommonElements.java

/**
 * Quit Confirmation pop up dialog//from  w w w  . ja  v  a 2  s  .co  m
 * 
 * @param parent - parent component
 * @param message - message to use instead of default
 * @return boolean if quit (true) or cancel dialog (false)
 */
public static boolean quitConfirmed(Component parent, String message) {
    if (message == null) {
        message = "Do you really want to close the application?\n"
                + "Doing so will cancel any running imports.";
    }
    String s1 = "No";
    String s2 = "Yes";
    Object[] options = { s2, s1 };
    int n = JOptionPane.showOptionDialog(parent, message, "Exit Application", JOptionPane.YES_NO_OPTION,
            JOptionPane.QUESTION_MESSAGE, null, options, s1);
    //b/c of switch of location
    if (n == JOptionPane.YES_OPTION) {
        return true;
    } else {
        return false;
    }
}

From source file:op.controlling.PnlControlling.java

private JPanel createContentPanel4Hygiene() {
    JPanel pnlContent = new JPanel(new VerticalLayout());

    JPanel pnlPrevalence = new JPanel(new BorderLayout());
    final JButton btnPrevalence = GUITools.createHyperlinkButton("opde.controlling.hygiene.prevalence", null,
            null);/*from w w w  .jav a 2 s .c om*/
    final JDateChooser jdc = new JDateChooser(new Date());
    final JCheckBox cbAnonymous = new JCheckBox(SYSTools.xx("misc.msg.anon"));
    cbAnonymous.setSelected(true);

    jdc.setMaxSelectableDate(new Date());

    btnPrevalence.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            OPDE.getMainframe().setBlocked(true);
            SwingWorker worker = new SwingWorker() {
                @Override
                protected Object doInBackground() throws Exception {
                    MREPrevalenceSheets mre = new MREPrevalenceSheets(new LocalDate(), cbAnonymous.isSelected(),
                            progressClosure);
                    return mre.createSheet();
                }

                @Override
                protected void done() {
                    try {
                        File source = (File) get();

                        Object[] options = { SYSTools.xx("prevalence.optiondialog.option1"),
                                SYSTools.xx("prevalence.optiondialog.option2"),
                                SYSTools.xx("opde.wizards.buttontext.cancel") };

                        int n = JOptionPane.showOptionDialog(OPDE.getMainframe(),
                                SYSTools.xx("prevalence.optiondialog.question"),
                                SYSTools.xx("prevalence.optiondialog.title"), JOptionPane.YES_NO_CANCEL_OPTION,
                                JOptionPane.QUESTION_MESSAGE, null, options, options[1]);

                        File copyTargetDirectory = null;

                        if (n == 1) {
                            JFileChooser chooser = new JFileChooser();
                            chooser.setDialogTitle("title");
                            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                            chooser.setMultiSelectionEnabled(false);
                            chooser.setAcceptAllFileFilterUsed(false);

                            if (chooser.showOpenDialog(pnlPrevalence) == JFileChooser.APPROVE_OPTION) {
                                copyTargetDirectory = chooser.getSelectedFile();
                            }
                        }

                        if (copyTargetDirectory != null) {
                            FileUtils.copyFile(source, copyTargetDirectory);
                        } else {
                            if (n == 0) {
                                SYSFilesTools.handleFile((File) get(), Desktop.Action.OPEN);
                            }
                        }

                    } catch (Exception e) {
                        OPDE.fatal(e);
                    }

                    OPDE.getDisplayManager().setProgressBarMessage(null);
                    OPDE.getMainframe().setBlocked(false);
                }
            };
            worker.execute();
        }
    });
    pnlPrevalence.add(btnPrevalence, BorderLayout.WEST);

    JPanel optionPanel = new JPanel();
    optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.LINE_AXIS));

    optionPanel.add(cbAnonymous);
    optionPanel.add(jdc);

    pnlPrevalence.add(optionPanel, BorderLayout.EAST);
    pnlContent.add(pnlPrevalence);

    return pnlContent;
}