Example usage for javax.swing JOptionPane INFORMATION_MESSAGE

List of usage examples for javax.swing JOptionPane INFORMATION_MESSAGE

Introduction

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

Prototype

int INFORMATION_MESSAGE

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

Click Source Link

Document

Used for information messages.

Usage

From source file:dialog.DialogFunctionUser.java

private void actionEditUser() {
    if (!isValidData()) {
        return;/*  w ww.j  a v  a2 s .c o  m*/
    }
    if (!isValidData()) {
        return;
    }
    String username = tfUsername.getText();
    String fullname = tfFullname.getText();
    String password = mUser.getPassword();
    if (tfPassword.getPassword().length == 0) {
        password = new String(tfPassword.getPassword());
        password = LibraryString.md5(password);
    }
    int role = cbRole.getSelectedIndex();
    if (mAvatar != null) {
        User objUser = new User(mUser.getIdUser(), username, password, fullname, role,
                new Date(System.currentTimeMillis()), mAvatar.getPath());
        if (mControllerUser.editItem(objUser, mRow)) {
            String fileName = FilenameUtils.getBaseName(mAvatar.getName()) + "-" + System.nanoTime() + "."
                    + FilenameUtils.getExtension(mAvatar.getName());
            Path source = Paths.get(mAvatar.toURI());
            Path destination = Paths.get("files/" + fileName);
            Path pathOldAvatar = Paths.get(mUser.getAvatar());
            try {
                Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
                Files.deleteIfExists(pathOldAvatar);
            } catch (IOException ex) {
                Logger.getLogger(DialogFunctionRoom.class.getName()).log(Level.SEVERE, null, ex);
            }
            ImageIcon icon = new ImageIcon(getClass().getResource("/images/ic_success.png"));
            JOptionPane.showMessageDialog(this.getParent(), "Sa thnh cng", "Success",
                    JOptionPane.INFORMATION_MESSAGE, icon);
        } else {
            JOptionPane.showMessageDialog(this.getParent(), "Sa tht bi", "Fail",
                    JOptionPane.ERROR_MESSAGE);
        }
    } else {
        User objUser = new User(mUser.getIdUser(), username, password, fullname, role,
                new Date(System.currentTimeMillis()), mUser.getAvatar());
        if (mControllerUser.editItem(objUser, mRow)) {
            ImageIcon icon = new ImageIcon(getClass().getResource("/images/ic_success.png"));
            JOptionPane.showMessageDialog(this.getParent(), "Sa thnh cng", "Success",
                    JOptionPane.INFORMATION_MESSAGE, icon);
        } else {
            JOptionPane.showMessageDialog(this.getParent(), "Sa tht bi", "Fail",
                    JOptionPane.ERROR_MESSAGE);
        }
    }
    this.dispose();
}

From source file:com.heliosdecompiler.helios.bootloader.Bootloader.java

private static void displayError(Throwable t) {
    t.printStackTrace();/*from   w  ww.  jav  a 2 s .c om*/
    StringWriter writer = new StringWriter();
    t.printStackTrace(new PrintWriter(writer));
    JOptionPane.showMessageDialog(null, writer.toString(), t.getClass().getSimpleName(),
            JOptionPane.INFORMATION_MESSAGE);
}

From source file:edu.harvard.i2b2.analysis.queryClient.CRCQueryClient.java

public static String sendPDOQueryRequestSOAP(String XMLstr) {
    try {/*from  w w  w.j  a  v  a  2 s .c  o  m*/
        MessageUtil.getInstance().setRequest("URL: " + getPDOServiceName() + "\n" + XMLstr);
        ServiceClient sender = AxisServiceClient.getServiceClient();
        OperationClient operationClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

        // creating message context
        MessageContext outMsgCtx = new MessageContext();
        // assigning message context's option object into instance variable
        Options opts = outMsgCtx.getOptions();
        // setting properties into option

        targetEPR = new EndpointReference(UserInfoBean.getInstance().getCellDataUrl("IM"));

        log.debug(targetEPR);
        opts.setTo(targetEPR);
        opts.setAction("http://rpdr.partners.org/GetPatientDataObject");
        opts.setTimeOutInMilliSeconds(180000);

        log.debug(XMLstr);

        SOAPEnvelope envelope = null;
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        envelope = fac.getDefaultEnvelope();
        OMNamespace omNs = fac.createOMNamespace("http://rpdr.partners.org/", "rpdr");

        // creating the SOAP payload
        OMElement method = fac.createOMElement("GetPatientDataObject", omNs);
        OMElement value = fac.createOMElement("RequestXmlString", omNs);
        value.setText(XMLstr);
        method.addChild(value);
        envelope.getBody().addChild(method);

        outMsgCtx.setEnvelope(envelope);

        operationClient.addMessageContext(outMsgCtx);
        operationClient.execute(true);

        MessageContext inMsgtCtx = operationClient.getMessageContext("In");
        SOAPEnvelope responseEnv = inMsgtCtx.getEnvelope();

        OMElement soapResponse = responseEnv.getBody().getFirstElement();
        // log.debug("Sresponse: "+ soapResponse.toString());
        OMElement soapResult = soapResponse.getFirstElement();
        // log.debug("Sresult: "+ soapResult.toString());

        String i2b2Response = soapResult.getText();
        log.debug(i2b2Response);
        MessageUtil.getInstance().setResponse("URL: " + getPDOServiceName() + "\n" + i2b2Response);
        return i2b2Response;

    } catch (AxisFault axisFault) {
        axisFault.printStackTrace();
        if (axisFault.getMessage().indexOf("No route to host") >= 0) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JOptionPane.showMessageDialog(null,
                            "Unable to make a connection to the remote server,\n this is often a network error, please try again",
                            "Network Error", JOptionPane.INFORMATION_MESSAGE);
                }
            });
        } else if (axisFault.getMessage().indexOf("Read timed out") >= 0) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JOptionPane.showMessageDialog(null,
                            "Unable to obtain a response from the remote server, this is often a network error, please try again",
                            "Network Error", JOptionPane.INFORMATION_MESSAGE);
                }
            });
        }
        return null;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:edu.harvard.i2b2.patientMapping.serviceClient.IMQueryClient.java

public static String sendPDQQueryRequestSOAP(String XMLstr) {
    try {//  ww  w  . jav a  2s. c  o  m
        MessageUtil.getInstance().setRequest("URL: " + getSetKeyServiceName() + "\n" + XMLstr);

        HttpTransportProperties.Authenticator basicAuthentication = new HttpTransportProperties.Authenticator();

        basicAuthentication.setUsername(UserInfoBean.getInstance().getUserName());
        basicAuthentication.setPassword(UserInfoBean.getInstance().getUserPassword());

        OMElement payload = getQueryPayLoad(XMLstr);
        Options options = new Options();

        // options.setProperty(HTTPConstants.PROXY, proxyProperties);
        targetEPR = new EndpointReference(getSetKeyServiceName());
        options.setTo(targetEPR);

        options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, basicAuthentication);

        options.setTimeOutInMilliSeconds(900000);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

        ConfigurationContext configContext =

                ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);

        // Blocking invocation
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.setOptions(options);

        OMElement responseElement = sender.sendReceive(payload);
        // log.debug("Client Side response " + responseElement.toString());

        MessageUtil.getInstance()
                .setResponse("URL: " + getSetKeyServiceName() + "\n" + responseElement.toString());
        return responseElement.toString();

    } catch (AxisFault axisFault) {
        axisFault.printStackTrace();
        if (axisFault.getMessage().indexOf("No route to host") >= 0) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JOptionPane.showMessageDialog(null,
                            "Unable to make a connection to the remote server,\n this is often a network error, please try again",
                            "Network Error", JOptionPane.INFORMATION_MESSAGE);
                }
            });
        } else if (axisFault.getMessage().indexOf("Read timed out") >= 0) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JOptionPane.showMessageDialog(null,
                            "Unable to obtain a response from the remote server, this is often a network error, please try again",
                            "Network Error", JOptionPane.INFORMATION_MESSAGE);
                }
            });
        }
        return null;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:it.cnr.icar.eric.client.ui.swing.RegistryObjectsTableModel.java

@SuppressWarnings("unchecked")
void update(BulkResponse response) {
    Collection<Object> registryObjects = new ArrayList<Object>();
    try {//from  w w w . ja  v  a 2  s .co  m
        // check for errors
        Collection<?> exceptions = response.getExceptions();
        if (exceptions != null) {
            String errMsg = resourceBundle.getString("error.registryRequest");
            Iterator<?> iter = exceptions.iterator();
            Exception exception = null;
            while (iter.hasNext()) {
                exception = (Exception) iter.next();
                RegistryBrowser.displayError(errMsg, exception);
            }
        }

        // check for objects
        // collection may be empty if there were errors
        registryObjects.addAll(response.getCollection());
        //Get the most specific object type that is common to all RegistryObjects
        Concept commonObjectType = UIUtility.getInstance().getCommonObjectType(registryObjects);
        //Dynamically update model configuration basd upon objectType
        updateConfiguration(commonObjectType);
    } catch (JAXRException e) {
        RegistryBrowser.displayError(e);
    }

    if (registryObjects.isEmpty()) {
        JOptionPane.showMessageDialog(null, resourceBundle.getString("message.noObjects"),
                resourceBundle.getString("title.registryBrowser.java"), JOptionPane.INFORMATION_MESSAGE);
    }

    setRegistryObjects(registryObjects);
}

From source file:com.tiempometa.muestradatos.JMuestraDatos.java

private void usbConnectButtonActionPerformed(ActionEvent e) {
    if (ReaderContext.isUsbConnected()) {
        if (ReaderContext.isUsbReading()) {
            JOptionPane.showMessageDialog(this,
                    "Debes detener todas las lecturas antes de desconectar el lector", "Lectura activa",
                    JOptionPane.WARNING_MESSAGE);
        } else {/*from ww w  .  j ava  2 s. c o m*/
            try {
                ReaderContext.disconnectUsbReader();
                JOptionPane.showMessageDialog(this, "Se desconect con xito del lector usb",
                        "Desconexin exitosa", JOptionPane.INFORMATION_MESSAGE);
                usbConnectButton.setText("Conectar");
            } catch (ReaderException e1) {
                JOptionPane.showMessageDialog(this, "Error de desconexin: " + e1.getMessage(), "Error USB",
                        JOptionPane.ERROR_MESSAGE);
            }

        }
    } else {
        try {
            ReaderContext.connectUsbReader(ReaderContext.getSettings().getUsbPort());
            JOptionPane.showMessageDialog(this, "Se conect con xito al lector usb", "Conexin exitosa",
                    JOptionPane.INFORMATION_MESSAGE);
            usbConnectButton.setText("Desonectar");
        } catch (ReaderException e1) {
            JOptionPane.showMessageDialog(this, "Error de conexin: " + e1.getMessage(), "Error USB",
                    JOptionPane.ERROR_MESSAGE);
        }
    }
}

From source file:com.smanempat.controller.ControllerEvaluation.java

public void proccessMining(JTable tableDataSetModel, JTable tableDataSetTesting, JTextField txtNumberOfK,
        JLabel labelPesanError, JTabbedPane jTabbedPane1, JTable tableResult, JTable tableConfMatrix,
        JTable tableTahunTesting, JLabel totalAccuracy, JPanel panelChart, JPanel panelChart1,
        JPanel panelChart2, JRadioButton singleTesting, JRadioButton multiTesting, JTextArea txtArea)
        throws SQLException {
    Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
    modelEvaluation = new ModelEvaluation();
    int rowCountModel = tableDataSetModel.getRowCount();
    int rowCountTest = tableDataSetTesting.getRowCount();
    int[] tempK;// w ww .  j a va 2  s.c  o m
    double[][] tempEval;
    double[][] evalValue;
    boolean valid = false;

    /*Validasi Dataset Model dan Dataset Uji*/
    if (rowCountModel == 0) {
        JOptionPane.showMessageDialog(null, "Pilih dataset model terlebih dahulu!", "Error",
                JOptionPane.INFORMATION_MESSAGE,
                new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
        txtNumberOfK.requestFocus();
    } else if (rowCountTest == 0) {
        JOptionPane.showMessageDialog(null, "Pilih dataset uji terlebih dahulu!", "Error",
                JOptionPane.INFORMATION_MESSAGE,
                new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
        txtNumberOfK.requestFocus();
    } else {
        valid = true;
    }
    /*Validasi Dataset Model dan Dataset Uji*/

    if (valid == true) {
        if (multiTesting.isSelected()) {
            String iterasi = JOptionPane.showInputDialog("Input Jumlah Iterasi Pengujian :");
            boolean validMulti = false;

            if (iterasi != null) {

                /*Validasi Jumlah Iterasi*/
                if (Pattern.matches("[0-9]+", iterasi) == false && iterasi.length() > 0) {
                    JOptionPane.showMessageDialog(null, "Nilai iterasi tidak valid!", "Error",
                            JOptionPane.INFORMATION_MESSAGE,
                            new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                } else if (iterasi.isEmpty()) {
                    JOptionPane.showMessageDialog(null, "Nilai iterasi tidak boleh kosong!", "Error",
                            JOptionPane.INFORMATION_MESSAGE,
                            new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                } else if (iterasi.length() == 9) {
                    JOptionPane.showMessageDialog(null, "Nilai iterasi terlalu panjang!", "Error",
                            JOptionPane.INFORMATION_MESSAGE,
                            new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                } else if (rowCountTest > rowCountModel) {

                    JOptionPane.showMessageDialog(null, "Data Uji tidak boleh lebih besar daripada data Model!",
                            "Error", JOptionPane.INFORMATION_MESSAGE,
                            new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                } else {
                    validMulti = true;
                    System.out.println("valiMulti = " + validMulti + " Kok");
                }
                /*Validasi Jumlah Iterasi*/
            }

            if (validMulti == true) {
                tempK = new int[Integer.parseInt(iterasi)];
                evalValue = new double[3][tempK.length];
                for (int i = 0; i < Integer.parseInt(iterasi); i++) {
                    validMulti = false;
                    String k = JOptionPane
                            .showInputDialog("Input Nilai Nearest Neighbor (k) ke " + (i + 1) + " :");
                    if (k != null) {
                        /*Validasi Nilai K Tiap Iterasi*/
                        if (Pattern.matches("[0-9]+", k) == false && k.length() > 0) {
                            JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) tidak valid!",
                                    "Error", JOptionPane.INFORMATION_MESSAGE,
                                    new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                        } else if (k.isEmpty()) {
                            JOptionPane.showMessageDialog(null,
                                    "Nilai nearest neighbor (k) tidak boleh kosong!", "Error",
                                    JOptionPane.INFORMATION_MESSAGE,
                                    new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                        } else if (k.length() == 9) {
                            JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) terlalu panjang!",
                                    "Error", JOptionPane.INFORMATION_MESSAGE,
                                    new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                        } else {
                            validMulti = true;
                        }
                        /*Validasi Nilai K Tiap Iterasi*/
                    }

                    if (validMulti == true) {
                        tempK[i] = Integer.parseInt(k);
                        System.out.println(tempK[i]);
                    } else {
                        break;
                    }
                }

                if (validMulti == true) {
                    for (int i = 0; i < tempK.length; i++) {
                        int kValue = tempK[i];
                        String[][] modelValue = getModelValue(rowCountModel, tableDataSetModel);
                        double[][] testValue = getTestvalue(rowCountTest, tableDataSetTesting);
                        String[] knnValue = getKNNValue(rowCountModel, rowCountTest, modelValue, testValue,
                                kValue);
                        tempEval = evaluationModel(tableResult, tableConfMatrix, totalAccuracy,
                                tableTahunTesting, tableDataSetTesting, knnValue, i, tempK, panelChart);
                        //Menampung nilai Accuracy
                        evalValue[0][i] = tempEval[0][i];
                        //Menampung nilai Recall
                        evalValue[1][i] = tempEval[1][i];
                        //Menampung nilai Precision
                        evalValue[2][i] = tempEval[2][i];
                        jTabbedPane1.setSelectedIndex(1);
                        txtArea.append(
                                "Tingkat Keberhasilan Sistem dengan Nilai Number of Nearest Neighbor (K) = "
                                        + tempK[i] + "\n");
                        txtArea.append("Akurasi\t\t: " + evalValue[0][i] * 100 + " %\n");
                        txtArea.append("Recall\t\t: " + evalValue[1][i] * 100 + " %\n");
                        txtArea.append("Precision\t: " + evalValue[2][i] * 100 + " %\n");
                        txtArea.append(
                                "=============================================================================\n");
                    }
                    showChart(tempK, evalValue, panelChart, panelChart1, panelChart2);
                }
            }
        } else if (singleTesting.isSelected()) {
            boolean validSingle = false;
            String k = txtNumberOfK.getText();
            int nilaiK = 0;
            evalValue = new double[3][1];

            /*Validasi Nilai Number of Nearest Neighbor*/
            if (Pattern.matches("[0-9]+", k) == false && k.length() > 0) {
                labelPesanError.setText("Number of Nearest Neighbor tidak valid");
                JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak valid!", "Error",
                        JOptionPane.INFORMATION_MESSAGE,
                        new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                txtNumberOfK.requestFocus();
            } else if (k.isEmpty()) {
                JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak boleh kosong!", "Error",
                        JOptionPane.INFORMATION_MESSAGE,
                        new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                labelPesanError.setText("Number of Nearest Neighbor tidak boleh kosong");
                txtNumberOfK.requestFocus();
            } else if (rowCountModel == 0 && Integer.parseInt(k) >= rowCountModel) {
                JOptionPane.showMessageDialog(null, "Pilih dataset model terlebih dahulu!", "Error",
                        JOptionPane.INFORMATION_MESSAGE,
                        new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                txtNumberOfK.requestFocus();
            } else if (rowCountTest == 0 && Integer.parseInt(k) >= rowCountTest) {
                JOptionPane.showMessageDialog(null, "Pilih dataset uji terlebih dahulu!", "Error",
                        JOptionPane.INFORMATION_MESSAGE,
                        new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                txtNumberOfK.requestFocus();
            } else if (Integer.parseInt(k) >= rowCountModel) {
                JOptionPane.showMessageDialog(null,
                        "Number of Nearest Neighbor tidak boleh lebih dari " + rowCountModel + " !", "Error",
                        JOptionPane.INFORMATION_MESSAGE,
                        new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png")));
                txtNumberOfK.requestFocus();
            } else {
                validSingle = true;
                nilaiK = Integer.parseInt(k);
            }
            /*Validasi Nilai Number of Nearest Neighbor*/

            if (validSingle == true) {
                int confirm;
                int i = 0;
                confirm = JOptionPane.showOptionDialog(null, "Yakin ingin memproses data?",
                        "Proses Klasifikasi", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null,
                        null, null);
                if (confirm == JOptionPane.OK_OPTION) {

                    int kValue = Integer.parseInt(txtNumberOfK.getText());
                    String[][] modelValue = getModelValue(rowCountModel, tableDataSetModel);
                    double[][] testValue = getTestvalue(rowCountTest, tableDataSetTesting);
                    String[] knnValue = getKNNValue(rowCountModel, rowCountTest, modelValue, testValue, kValue);
                    tempEval = evaluationModel(tableResult, tableConfMatrix, totalAccuracy, tableTahunTesting,
                            tableDataSetTesting, knnValue, nilaiK, panelChart);
                    evalValue[0][i] = tempEval[0][0];
                    evalValue[1][i] = tempEval[1][0];
                    evalValue[2][i] = tempEval[2][0];
                    jTabbedPane1.setSelectedIndex(1);
                }
                System.out.println("com.smanempat.controller.ControllerEvaluation.proccessMining()OKOKOK");
                showChart(nilaiK, evalValue, panelChart, panelChart1, panelChart2);
                Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
            }
        }
    }

}

From source file:net.openbyte.gui.CreateProjectFrame.java

private void comboBox1ItemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED) {
        if (comboBox1.getSelectedIndex() == 1) {
            // mcp
            if (!System.getProperty("os.name").startsWith("Windows")) {
                JOptionPane.showMessageDialog(this,
                        "Python is required for MCP, please make sure you have Python installed.",
                        "Notification", JOptionPane.INFORMATION_MESSAGE);
            }//from  w w  w .j av a2s  . co m
            String[] versions = new String[] { "1.9", "1.8.9", "1.7.10" };
            DefaultComboBoxModel mcpModel = new DefaultComboBoxModel(versions);
            comboBox2.setModel(mcpModel);
            return;
        }
        if (comboBox1.getSelectedIndex() == 0) {
            // mcforge
            String[] versions = new String[] { "1.8.9", "1.7.10" };
            DefaultComboBoxModel forgeModel = new DefaultComboBoxModel(versions);
            comboBox2.setModel(forgeModel);
            return;
        }
        if (((String) comboBox1.getSelectedItem()).equals("Bukkit")) {
            // bukkit
            JOptionPane.showMessageDialog(this, "Bukkit is solely ONLY the API, not the implementation!",
                    "Notification", JOptionPane.INFORMATION_MESSAGE);
            String[] versions = new String[] { "1.9" };
            DefaultComboBoxModel bukkitModel = new DefaultComboBoxModel(versions);
            comboBox2.setModel(bukkitModel);
            return;
        }
    }
}

From source file:LoginUI.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) throws ParseException {
    HashMap<String, String> userpw = getUserInfo();
    String inputuser = jTextField1.getText();
    char[] inputpw = jTextField2.getPassword();
    String pw = new String(inputpw);
    //wrong username
    if (!userpw.containsKey(inputuser)) {
        JOptionPane.showMessageDialog(null, "Username does not exist!", "Failed", JOptionPane.ERROR_MESSAGE);
    }/*from w  ww  .ja va2 s.co m*/

    // wrong password
    else if (!userpw.get(inputuser).equals(pw)) {
        JOptionPane.showMessageDialog(null, "Incorrect Password", "Failed", JOptionPane.ERROR_MESSAGE);
    }

    else {
        MainGUI main = new MainGUI(inputuser);
        JOptionPane.showMessageDialog(null, "Login Successful!", "Success!", JOptionPane.INFORMATION_MESSAGE);
        WindowEvent winClosingEvent = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClosingEvent);

        main.setVisible(true);
    }
}

From source file:roaded.MainGUI.java

public void infoBox(String infoMessage, String titleBar) {
    JOptionPane.showMessageDialog(null, infoMessage, "RoadEd: " + titleBar, JOptionPane.INFORMATION_MESSAGE);
}