Example usage for javax.swing JOptionPane ERROR_MESSAGE

List of usage examples for javax.swing JOptionPane ERROR_MESSAGE

Introduction

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

Prototype

int ERROR_MESSAGE

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

Click Source Link

Document

Used for error messages.

Usage

From source file:com.pingtel.sipviewer.SIPViewerFrame.java

public void applyAliasesFile(String strAliasesFile) {
    try {/*from   www  .  j  a v a 2 s.  com*/
        FileReader fr = new FileReader(strAliasesFile);

        BufferedReader reader = new BufferedReader(fr);
        String strLine = reader.readLine();
        while (strLine != null) {
            int pos = strLine.indexOf("=");
            if (pos > 0) {
                String strValue = strLine.substring(0, pos);
                String strKey = strLine.substring(pos + 1);

                strKey = strKey.trim();
                strValue = strValue.trim();

                // System.out.println("AddAlias: " + strValue + " -> " +
                // strKey) ;

                m_model.removeKey(strValue);
                m_model.addKeyAlias(strKey, strValue);
                m_model.reindexData();
            }

            strLine = reader.readLine();
        }

        reader.close();
        fr.close();
    } catch (Exception e) {
        System.out.println("Unable to apply aliases file: " + strAliasesFile);

        JOptionPane.showConfirmDialog(null, "Unable to apply aliases file: " + strAliasesFile, "Error",
                JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null);
        e.printStackTrace();
        this.dispose();
    }
}

From source file:gtu._work.ui.RetryByPassUI.java

private void showMessage(String message) {
    JOptionPane.showMessageDialog(null, message, "ERROR", JOptionPane.ERROR_MESSAGE);
}

From source file:avoking.com.documentos.scheduler.startup.Main.java

public void init() {
    ctx = new ClassPathXmlApplicationContext("/spring-test-dao-context.xml");

    LOGGER.info("Iniciando aplicacin....");

    loadParams();// w  w w  . j  a  v a 2s.com

    LOGGER.info("Se especificaron las siguientes ruta");
    LOGGER.info("Procedimientos: \t" + pathPro);
    LOGGER.info("Especificaciones: \t" + pathEsp);
    LOGGER.info("Politicas: \t" + pathPol);
    LOGGER.info("Comenzando exploracin.");
    LOGGER.debug("Creando hyper-threading");
    Runnable run = new Runnable() {
        @Override
        public void run() {
            Core instancia1 = null;
            Core instancia2 = null;
            Core instancia3 = null;

            if ((pathPro.equals(pathEsp)) && (pathPro.equals(pathPol)))
                instancia1 = new Core(pathPro);
            else if (pathPol.equals(pathEsp))
                instancia2 = new Core(pathPol);
            else {
                if (!pathPro.isEmpty())
                    instancia1 = new Core(pathPro);

                if (!pathEsp.isEmpty())
                    instancia2 = new Core(pathEsp);

                if (!pathPol.isEmpty())
                    instancia3 = new Core(pathPol);
            }

            if (instancia1 != null) {
                new ProgressBarAction(splashLoading, instancia1);
                instancia1.execute();
            }
            if (instancia2 != null) {
                new ProgressBarAction(splashLoading, instancia2);
                instancia2.execute();
            }
            if (instancia3 != null) {
                new ProgressBarAction(splashLoading, instancia3);
                instancia3.execute();
            }

            try {
                String si1, si2, si3;
                si1 = si2 = si3 = "";

                if (instancia1 != null)
                    si1 = instancia1.get();
                if (instancia2 != null)
                    si2 = instancia2.get();
                if (instancia3 != null)
                    si3 = instancia3.get();

                splashLoading.dispose();

                if (!si1.isEmpty() || !si2.isEmpty() || !si3.isEmpty()) {
                    LOGGER.warn("Se encontraron los siguientes errores:\n" + si1 + "\n" + si2 + "\n" + si3);
                    JOptionPane.showMessageDialog(null,
                            "Se encontraron los siguientes errores: \n" + si1 + "\n" + si2 + "\n" + si3,
                            "Se encontraron errores al realizar la busqueda.", JOptionPane.ERROR_MESSAGE);
                }
                frmPortal.setLocationRelativeTo(null);
                frmPortal.setVisible(true);
            } catch (InterruptedException ex) {
                java.util.logging.Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            } catch (ExecutionException ex) {
                java.util.logging.Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    };

    Thread hilo = new Thread(run);
    LOGGER.debug("Iniciando el hilo del mal :D");
    hilo.start();

    //        if(!path.equals("Error 404.")){
    //            //Ruta de los documentos
    //            LOGGER.info("Ruta de los documentos: " + path);
    //            //Explorar/crear objetos(Sacar departamento)
    //            LOGGER.info("Obteniendo datos...");
    //            
    //        }
}

From source file:it.txt.access.capability.demo.soap.client.view.ClientGUIController.java

protected static void showErrorMessage(Component parent, String title, String msg) {
    JOptionPane.showMessageDialog(parent, msg, title, JOptionPane.ERROR_MESSAGE);
}

From source file:sample.fa.ScriptRunnerApplication.java

private void saveScript(ActionEvent ae) {
    JFileChooser jfc = new JFileChooser();
    jfc.showOpenDialog(scriptContents);//w  w w . j av  a2  s.c o  m
    File f = jfc.getSelectedFile();
    if (f != null) {
        try {
            Files.write(f.toPath(), scriptContents.getText().getBytes());
        } catch (IOException ex) {
            JOptionPane.showMessageDialog(scriptContents, ex.getMessage(), "Error Saving Script",
                    JOptionPane.ERROR_MESSAGE);
        }
    }

}

From source file:be.ugent.maf.cellmissy.gui.controller.load.generic.area.GenericAreaImagedPlateController.java

/**
 * This is parsing a certain file, for a certain selected well and a
 * wellHasImagingType (i.e. dataset and imaging type are chosen)
 *
 * @param bulkCellFile/*  w w w. jav a  2 s  . c o m*/
 * @param newWellHasImagingType
 * @param selectedWellGui
 */
public void loadData(File bulkCellFile, WellHasImagingType newWellHasImagingType, WellGui selectedWellGui) {
    List<WellHasImagingType> wellHasImagingTypeList = selectedWellGui.getWell().getWellHasImagingTypeList();
    // parse raw data for selected well
    try {
        List<TimeStep> timeSteps = genericInputFileParser.parseBulkCellFile(bulkCellFile);
        // set the timeStepList and add the wellHasImagingType to the list
        newWellHasImagingType.setTimeStepList(timeSteps);
        wellHasImagingTypeList.add(newWellHasImagingType);
        for (TimeStep timeStep : timeSteps) {
            timeStep.setWellHasImagingType(newWellHasImagingType);
        }
        timeStepsBindingList.addAll(timeSteps);
    } catch (FileParserException ex) {
        LOG.error(ex.getMessage());
        genericImagedPlateController.showMessage(ex.getMessage(), "Generic input file error",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:BRHInit.java

public void login(String email, String password) {
    try {/*from w ww.j  a v a 2s. com*/
        // call get_login_cookie
        JSONArray params = new JSONArray();
        params.put(email);
        params.put(password);

        JSONObject response = json_rpc("get_login_cookie", params);
        //System.out.println(response.toString());
        cookie = (String) response.get("result");

        // call list_vps
        params = new JSONArray();

        response = json_rpc("list_vps", params);
        //System.out.println(response.toString());
        showVPSPrompt((JSONArray) response.get("result"));
    } catch (Exception e) {
        System.err.println(e);

        JOptionPane.showMessageDialog(null, "Login failed", "Login failed", JOptionPane.ERROR_MESSAGE);

        showLoginPrompt();
    }
}

From source file:com.microsoft.intellij.forms.ExternalStorageAccountForm.java

@Override
protected void doOKAction() {

    try {//from  w  w w  . j ava 2  s .  com
        //Validate querystring by making a request
        StorageClientSDKManagerImpl.getManager().getTables(StorageClientSDKManagerImpl.getManager()
                .getStorageAccount(getFullStorageAccount().getConnectionString()));

    } catch (AzureCmdException e) {
        JOptionPane.showMessageDialog(contentPane,
                "The storage account contains invalid values. More information:\n" + e.getCause().getMessage(),
                "Service Explorer", JOptionPane.ERROR_MESSAGE);
        return;
    }

    if (onFinish != null) {
        onFinish.run();
    }

    close(DialogWrapper.OK_EXIT_CODE, true);
}

From source file:dbseer.gui.chart.DBSeerChartFactory.java

public static DefaultPieDataset getPieDataset(String chartName, DBSeerDataSet dataset) throws Exception {
    StatisticalPackageRunner runner = DBSeerGUI.runner;

    runner.eval("[title legends Xdata Ydata Xlabel Ylabel timestamp] = plotter.plot" + chartName + ";");

    String title = runner.getVariableString("title");
    Object[] legends = (Object[]) runner.getVariableCell("legends");
    Object[] xCellArray = (Object[]) runner.getVariableCell("Xdata");
    Object[] yCellArray = (Object[]) runner.getVariableCell("Ydata");
    String xLabel = runner.getVariableString("Xlabel");
    String yLabel = runner.getVariableString("Ylabel");
    timestamp = runner.getVariableDouble("timestamp");

    DefaultPieDataset pieDataSet = new DefaultPieDataset();

    int numLegends = legends.length;
    int numXCellArray = xCellArray.length;
    int numYCellArray = yCellArray.length;
    int dataCount = 0;

    if (numXCellArray != numYCellArray) {
        JOptionPane.showMessageDialog(null, "The number of X dataset and Y dataset does not match.",
                "The number of X dataset and Y dataset does not match.", JOptionPane.ERROR_MESSAGE);
        return null;
    }// ww w.  ja  v  a 2 s. co m

    final java.util.List<String> transactionTypeNames = dataset.getTransactionTypeNames();

    for (int i = 0; i < numYCellArray; ++i) {
        double[] xArray = (double[]) xCellArray[i];
        runner.eval("yArraySize = size(Ydata{" + (i + 1) + "});");
        runner.eval("yArray = Ydata{" + (i + 1) + "};");
        double[] yArraySize = runner.getVariableDouble("yArraySize");
        double[] yArray = runner.getVariableDouble("yArray");

        int xLength = xArray.length;
        int row = (int) yArraySize[0];
        int col = (int) yArraySize[1];

        for (int c = 0; c < col; ++c) {
            if (c < transactionTypeNames.size()) {
                String name = transactionTypeNames.get(c);
                if (!name.isEmpty()) {
                    pieDataSet.setValue(name, yArray[c]);
                } else {
                    pieDataSet.setValue("Transaction Type " + (c + 1), yArray[c]);
                }
            }
        }
    }

    return pieDataSet;
}

From source file:net.mumie.coursecreator.xml.ELClassListWrapper.java

public Map getELClasses() {
    LinkedHashMap map = new LinkedHashMap();
    try {/*from ww  w.  j  a  v a2 s. c  o m*/
        babble("getELClasses(): constructing XPaths");
        XPath docPath = new DOMXPath("/mumie:pseudo_documents/mumie:class");
        docPath.addNamespace(StringUtils.substringBefore(XMLConstants.PREFIX_META, ":"), XMLConstants.NS_META);
        //         XPath idPath = new DOMXPath("./@id");
        //         XPath namePath = new DOMXPath("./name/*");
        XPath idPath = new DOMXPath("attribute::id");
        XPath pathPath = new DOMXPath("attribute::path");
        idPath.addNamespace(StringUtils.substringBefore(XMLConstants.PREFIX_META, ":"), XMLConstants.NS_META);
        XPath namePath = new DOMXPath("child::mumie:name/child::text()");
        namePath.addNamespace(StringUtils.substringBefore(XMLConstants.PREFIX_META, ":"), XMLConstants.NS_META);
        Element doc = classList.getDocumentElement();
        babble("getELClasses(): this is my document root: " + doc.toString());
        List li = docPath.selectNodes(doc);
        babble("getELClasses(): got back a list which "
                + (li == null ? "is null" : "has " + li.size() + " element(s)"));
        for (Iterator lit = li.iterator(); lit.hasNext();) {
            // FIXME(2): the loop body might use a minor code cleanup
            babble("getELClasses(): looping through nodes...");
            Object node = lit.next();
            //Object theID = idPath.selectSingleNode(node);
            Object thePath = pathPath.selectSingleNode(node);
            Object theName = namePath.selectSingleNode(node);
            String theNameStr = (theName instanceof Text ? ((Text) theName).getNodeValue() : "---");
            //Integer theNewId = (theID instanceof Attr ? Integer.valueOf(((Attr)theID).getValue()) : new Integer(XMLConstants.UNDEFINED_ID));
            String theNewPath = (thePath instanceof Attr ? ((Attr) thePath).getValue() : "/");
            babble("getELClasses(): Will put (" + theNewPath //theID.toString() 
                    + ",\"" + theNameStr + "\") into the map.");
            map.put(theNewPath, theNameStr);
            babble("getELClasses(): ...end of one loop");
        } // end of for (Iterator lit = li.iterator(); lit.hasNext();)       
    } catch (Exception ex) {
        CCController.dialogErrorOccured("ELClassListWrapper: Exception", "ELClassListWrapper: Exception: " + ex,
                JOptionPane.ERROR_MESSAGE);

        return null;
    } // end of try-catch
    return map;
}