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:com.freedomotic.jfrontend.MainWindow.java

private void submnuHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submnuHelpActionPerformed

    String runningUser = ((auth.getPrincipal() == null) ? "\n"
            : i18n.msg("running_as_user") + ": " + auth.getPrincipal() + "\n");
    JOptionPane.showMessageDialog(this, ""
            //+ I18n.msg("running_as_user") + ": " + Auth.getPrincipal() + "\n"
            + runningUser + i18n.msg("author") + ": " + Info.getAuthor() + "\n" + i18n.msg("email") + ": "
            + Info.getAuthorMail() + "\n" + i18n.msg("release") + ": " + Info.getReleaseDate() + ". "
            + Info.getVersionCodeName() + " - v" + Info.getVersion() + "\n" + i18n.msg("licence") + ": "
            + Info.getLicense() + "\n\n" + i18n.msg("find_support_msg") + ":\n"
            + "https://github.com/freedomotic/freedomotic" + "\n" + "http://freedomotic.com/", i18n.msg("info"),
            JOptionPane.INFORMATION_MESSAGE);
}

From source file:Interfaz.rubiktimer.java

private void guardar4x4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guardar4x4ActionPerformed
    // TODO add your handling code here:
    if (listaT4x4.primero != null) {
        GuardarDatos dat = new GuardarDatos();
        dat.guardarArchivo(listaT4x4, "4 x 4", 1);
    } else {/*from  w  w w.j av  a  2 s  .c o  m*/
        JOptionPane.showMessageDialog(null, "No puede guardar en un documento una Sesion VACIA (4x4)",
                "Sesion Vacia", JOptionPane.INFORMATION_MESSAGE);
    }

}

From source file:contactsdirectory.frontend.MainJFrame.java

private void editContact() {
    if (jListContact.getSelectedIndex() < 0) {
        JOptionPane.showMessageDialog(rootPane, localizedTexts.getString("noContactSelected"), "",
                JOptionPane.INFORMATION_MESSAGE);
        return;/*from   www . ja va2 s  .  co m*/
    }

    final ContactJDialog dialog = new ContactJDialog(this, true);
    dialog.setContact((Contact) jListContact.getSelectedValue());//.getContact());        

    if (JOptionPane.OK_OPTION == dialog.showDialog())//contact != null)
    {
        Contact contact = dialog.getContact();

        try {
            jProgressBar.setIndeterminate(true);
            jProgressBar.setVisible(true);

            EditContactSwingWorker worker = new EditContactSwingWorker(contact);
            worker.execute();

            updateContactDetail();

            jProgressBar.setVisible(false);
            jProgressBar.setIndeterminate(false);
        } catch (RuntimeException e) {
            JOptionPane.showMessageDialog(this, localizedTexts.getString("editContactErrMsg"),
                    localizedTexts.getString("errorMsgTitle"), JOptionPane.ERROR_MESSAGE);
        }
    }
}

From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java

protected void showLicense(String licenseFile) throws IOException {
    final JTextArea textarea = new JTextArea(
            IOUtils.toString(FileSync.class.getResourceAsStream("/licenses/" + licenseFile)));

    JPanel p = new JPanel(new BorderLayout());

    JScrollPane scrollpane = new JScrollPane(textarea);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    p.add(scrollpane, BorderLayout.CENTER);
    p.setMaximumSize(new Dimension(screenSize.width / 2, screenSize.height / 2));
    p.setPreferredSize(new Dimension(screenSize.width / 2, screenSize.height / 2));
    p.setSize(new Dimension(screenSize.width / 2, screenSize.height / 2));

    JOptionPane.showMessageDialog(mainFrame, p, "Lizenz", JOptionPane.INFORMATION_MESSAGE);

}

From source file:userInterface.EnergySourceBoardSupervisor.ManageEnergyConsumptionsJPanel.java

private void sendAlertBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendAlertBtnActionPerformed
    int selectedRow = applianceTable.getSelectedRow();
    Date requestDate = new Date();
    Person person = (Person) houseAdminComboBox.getSelectedItem();
    //account.getPerson().getPersonName();
    String consumption = (String) applianceTable.getValueAt(selectedRow, 4);
    for (UserAccount ua : houseOrg.getUserAccDir().getUserAccountList()) {
        if (ua.getPerson().getPersonName().equals(person.getPersonName())) {
            account = ua;//from   ww  w .j  av a 2  s .  co  m
        }
    }
    if (selectedRow >= 0) {
        if (!consumption.equals("Efficient")) {
            if (!commentsTxt.getText().equals("")) {
                DefaultTableModel model = (DefaultTableModel) applianceTable.getModel();
                Sensor sensor = (Sensor) model.getValueAt(selectedRow, 0);
                String message = sensor.getSensorType().getValue();
                HighEnergyConsumptionWorkRequest request = new HighEnergyConsumptionWorkRequest();
                request.setMessage(message);
                request.setSender(userAccount);
                request.setReceiver(account);
                request.setStatus("sent");
                request.setEnergyConsumed(sensor.getNumberWatt());
                String comment = commentsTxt.getText();
                request.setComment(comment);
                request.setRequestDate(requestDate);
                Organization org = null;
                for (Organization organization : enterprise.getOrganizationList().getOrganizationList()) {
                    if (organization instanceof HouseholdOrg) {
                        org = organization;
                        break;
                    }
                }
                if (org != null) {
                    userAccount.getWorkQueue().getWorkRequestList().add(request);
                    account.getWorkQueue().getWorkRequestList().add(request);
                }
                populateAlertTable();
                JOptionPane.showMessageDialog(null, "Alert Sent", "INFORMATION",
                        JOptionPane.INFORMATION_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(null, "Kindly enter an alert message", "ERROR",
                        JOptionPane.ERROR_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(null, "Consumption is efficient.Alert not triggered", "MESSAGE",
                    JOptionPane.INFORMATION_MESSAGE);
        }
    } else {
        JOptionPane.showMessageDialog(null, "Please Select a Row", "WARNING", JOptionPane.WARNING_MESSAGE);
    }

}

From source file:userInterface.HospitalAdminRole.ManagePatientsJPanel.java

private void saveReportBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveReportBtnActionPerformed
    try {//from   w  w  w.  j  a  v  a  2  s.co m
        HSSFWorkbook fWorkbook = new HSSFWorkbook();
        HSSFSheet fSheet = fWorkbook.createSheet("new Sheet");
        HSSFFont sheetTitleFont = fWorkbook.createFont();
        File file = new File("C:\\Users\\Reshmi\\OneDrive\\Documents\\reports.xls");
        HSSFCellStyle cellStyle = fWorkbook.createCellStyle();

        sheetTitleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        //sheetTitleFont.setColor();
        TableModel model = vitalSignjTable.getModel();
        TableColumnModel tcm = vitalSignjTable.getColumnModel();
        HSSFRow fRow1 = fSheet.createRow((short) 0);

        for (int j = 0; j < tcm.getColumnCount(); j++) {

            HSSFCell cell = fRow1.createCell((short) j);
            cell.setCellValue(tcm.getColumn(j).getHeaderValue().toString());

        }

        for (int i = 0; i < model.getRowCount(); i++) {

            HSSFRow fRow = fSheet.createRow((short) i + 1);
            for (int j = 0; j < model.getColumnCount(); j++) {
                HSSFCell cell = fRow.createCell((short) j);
                cell.setCellValue(tcm.getColumn(j).getHeaderValue().toString());
                cell.setCellValue(model.getValueAt(i, j).toString());
                cell.setCellStyle(cellStyle);

            }

        }
        FileOutputStream fileOutputStream;
        fileOutputStream = new FileOutputStream(file);
        BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream);
        fWorkbook.write(bos);
        bos.close();
        fileOutputStream.close();
        JOptionPane.showMessageDialog(null, "File saved as reports.xls ", "Export",
                JOptionPane.INFORMATION_MESSAGE);
        //                Runtime run = Runtime.getRuntime();
        //                run.exec("cmd.exetart " + file);
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "File not saved", "Export", JOptionPane.INFORMATION_MESSAGE);
    }
}

From source file:com.proyecto.vista.MantenimientoBien.java

private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed
    // TODO add your handling code here:
    accion = Controlador.ELIMINAR;//  w  w  w .  j  av  a  2  s  . com
    if (tblbienes.getSelectedRow() != -1) {

        Integer codigo = tblbienes.getSelectedRow();

        Bien bien = bienControlador.buscarPorId(lista.get(codigo).getId());

        if (bien != null) {
            if (JOptionPane.showConfirmDialog(null, "Desea Eliminar la Bien?", "Mensaje del Sistema",
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

                int[] filas = tblbienes.getSelectedRows();
                for (int i = 0; i < filas.length; i++) {
                    Bien bien2 = lista.get(filas[0]);
                    lista.remove(bien2);
                    bienControlador.setSeleccionado(bien2);
                    bienControlador.accion(accion);
                }
                if (bienControlador.accion(accion) == 3) {
                    JOptionPane.showMessageDialog(null, "Bien eliminada correctamente", "Mensaje del Sistema",
                            JOptionPane.INFORMATION_MESSAGE);

                } else {
                    JOptionPane.showMessageDialog(null, "Bien no eliminada", "Mensaje del Sistema",
                            JOptionPane.ERROR_MESSAGE);
                }
            } else {
                JOptionPane.showMessageDialog(null, "Bien no eliminada", "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    } else {
        JOptionPane.showMessageDialog(null, "Debe seleccionar un Bien", "Mensaje del Sistema",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:com.biosis.biosislite.vistas.inventario.MantenimientoBien.java

private void btnguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarActionPerformed
    // TODO add your handling code here:
    String palabra = "";
    String palabra2 = "";
    if (accion == 1) {
        palabra = "registrar";
        palabra2 = "registrado";

        if (this.validar && (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " el Bien?",
                "Mensaje del Sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)) {

            bienControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase());
            //                bienControlador.getSeleccionado().setCodigo(idField.getText());
            bienControlador.getSeleccionado().setDescripcion(descripcionField.getText().toUpperCase());
            bienControlador.getSeleccionado().setFoto(fotoField.getText());
            bienControlador.getSeleccionado().setStockMinimo((Integer) spnStock.getValue());
            bienControlador.getSeleccionado().setStockMaximo((Integer) spnStockMax.getValue());

            if (this.validar) {
                bienControlador.getSeleccionado().setCodigo(this.txtCodigo.getText());
                this.validar = false;

            }/*from w w w  . ja  va 2  s  .c om*/

            //                Clase clase = (Clase) cmbClase.getSelectedItem();
            //                bienControlador.getSeleccionado().setClase(clase);
            bienControlador.accion(accion);
            lista.add(bienControlador.getSeleccionado());

            if (accion == 1) {
                JOptionPane.showMessageDialog(null, "Bien " + palabra2 + " correctamente",
                        "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE);

            } else {
                JOptionPane.showMessageDialog(null, "Bien no " + palabra2, "Mensaje del Sistema",
                        JOptionPane.WARNING_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(null, "Error en la informacin ingresada", "Mensaje del Sistema",
                    JOptionPane.ERROR_MESSAGE);
        }
    } else if (accion == 2) {
        palabra = "modificar";
        palabra2 = "modificado";

        if (JOptionPane.showConfirmDialog(null, "Desea " + palabra + " el Bien?", "Mensaje del Sistema",
                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

            if (accion == 2) {
                JOptionPane.showMessageDialog(null, "Bien " + palabra2 + " correctamente",
                        "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE);

                lista.clear();
                bienControlador.getSeleccionado().setNombre(nombreField.getText().toUpperCase());
                //                    bienControlador.getSeleccionado().setCodigo(nombreField.getText());
                bienControlador.getSeleccionado().setDescripcion(descripcionField.getText().toUpperCase());
                bienControlador.getSeleccionado().setFoto(fotoField.getText());
                bienControlador.getSeleccionado().setStockMinimo((Integer) spnStock.getValue());
                bienControlador.getSeleccionado().setStockMaximo((Integer) spnStockMax.getValue());

                //                    Clase clase = (Clase) cmbClase.getSelectedItem();
                //                    bienControlador.getSeleccionado().setClase(clase);
                bienControlador.accion(accion);
                listar();

            } else {
                JOptionPane.showMessageDialog(null, "Bien no " + palabra2, "Mensaje del Sistema",
                        JOptionPane.ERROR_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(null, "Bien no " + palabra2, "Mensaje del Sistema",
                    JOptionPane.ERROR_MESSAGE);
        }
    }

    for (DetalleBienCampo detalle : lista3) {
        detalle.setBien(bienControlador.getSeleccionado());
        detalleControlador.setSeleccionado(detalle);
        detalleControlador.accion(AbstractControlador.MODIFICAR);
    }

    lista3.clear();
    FormularioUtil.activarComponente(panelOpciones, true);
    FormularioUtil.activarComponente(panelGuardar, false);
    FormularioUtil.activarComponente(panelDatos, false);
    FormularioUtil.limpiarComponente(panelDatos);
    fotoLbl.setIcon(null);
    descripcionField.setText(null);

}

From source file:UserInterface.GarbageCollectorRole.GarbageCollectorWorkAreaJPanel.java

private void jSendToPTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jSendToPTActionPerformed
    int selectedRow = jGarbageCollector.getSelectedRow();
    GarbageCollectorWorkRequest gcwr = (GarbageCollectorWorkRequest) jGarbageCollector.getValueAt(selectedRow,
            0);//from w  ww. j a va2s .c  o m
    if (gcwr.getMessage().equalsIgnoreCase("Allocated")) {
        JOptionPane.showMessageDialog(null, "Already Assigned");
        return;

    }
    int plasticCollected;
    int plasticSegregated;
    String message = jMessageToPD.getText();

    if (message.trim().length() == 0) {
        JOptionPane.showMessageDialog(null, "MessageToPD cannot be null");
        return;

    }
    try {
        plasticCollected = Integer.parseInt(jPlasticCollected.getText().trim());
    } catch (NumberFormatException e) {
        JOptionPane.showMessageDialog(null, "Enter correct Plastic Collected  value in Kgs", "Information",
                JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    try {
        plasticSegregated = Integer.parseInt(jPlasticSegregated.getText().trim());
    } catch (NumberFormatException e) {
        JOptionPane.showMessageDialog(null, "Enter correct plastic Segregated value in Kgs", "Information",
                JOptionPane.INFORMATION_MESSAGE);
        return;
    }

    if (plasticCollected < plasticSegregated) {

        JOptionPane.showMessageDialog(null, "Collected Plastic value cannot be less than Segregated value",
                "Information", JOptionPane.INFORMATION_MESSAGE);
        return;

    }
    if (plasticCollected <= 0 || plasticSegregated < 0) {

        JOptionPane.showMessageDialog(null, "Incorrect Plastic values", "Information",
                JOptionPane.INFORMATION_MESSAGE);
        return;

    }
    if (selectedRow < 0) {
        JOptionPane.showMessageDialog(null, "Please select a row");
        return;
    }

    UserAccount ua = (UserAccount) jPlasticTransportation.getSelectedItem();

    if (ua.equals("")) {
        JOptionPane.showMessageDialog(null, "Please select a Plastic Transporter");
        return;
    }

    if (jPlasticCollected.equals("") || jPlasticSegregated.equals("")) {
        JOptionPane.showMessageDialog(null, "Please insert Plastic garbage details");
        return;

    }
    gcwr.setReceiver(userAccount);
    gcwr.setMessage("Allocated");
    gcwr.setStatus("Sent");
    gcwr.setCollectedPlastic(plasticCollected);
    gcwr.setSegregatedPlastic(plasticSegregated);
    gcwr.setMessageToPlasticDept(message);
    gcwr.setSentToPD(ua);
    gcwr.setType("Done");
    //        gcwr.setCollectedDegradable(0);
    //        gcwr.setCollectedPlastic(0);
    //        gcwr.setMessageToBioDept("");
    //        gcwr.setMessageToPlasticDept("");
    //        gcwr.setSegregatedDegradable(0);
    //        gcwr.setSegregatedPlastic(0);

    PlasticTransportationWorkRequest request = new PlasticTransportationWorkRequest();
    request.setMessage("To be Transported");
    request.setMessageToPlasticDept(message);
    request.setCollectedPlastic(plasticCollected);
    request.setSegregatedPlastic(plasticSegregated);
    request.setReceiver(ua);
    request.setRequestDate(gcwr.getRequestDate());

    Organization org = null;
    for (Organization organization : enterprise.getOrganizationDirectory().getOrganizationList()) {
        if (organization instanceof PlasticTransportationOrganization) {
            org = organization;
            break;
        }
    }
    if (org != null) {

        ua.getWorkQueue().getWorkRequestList().add(request);

        JOptionPane.showMessageDialog(null, "Work request added.");

    }
    refresh();
}

From source file:literarytermsquestionbank.AChristmasCarol.java

private void checkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkButtonActionPerformed
    String answerToCheck;//  ww w.  j  a v  a2 s .c  o m
    try {
        answerToCheck = answerTextField.getText(); // Get the text from the text entry field
        System.out.println(answerToCheck);
        if (!answerTextField.getText().equals("")) { // User has entered a valid string
            answerToCheck = answerToCheck.substring(0).toLowerCase(); // Convert to all lowercase
            answer = answer.substring(0).toLowerCase(); // Convert to all lowercase
            if (answer.contains(answerToCheck)) { // User was correct, show on button
                checkButton.setText("Correct!");
                checkButton.setBackground(Color.green);
                checkButton.setForeground(Color.white);
                nextButton.setEnabled(true);
            } else { // User was wrong, show on button
                checkButton.setText("Incorrect!");
                checkButton.setBackground(Color.red);
                checkButton.setForeground(Color.white);
            }
        } else { // User tried to check an empty string; prompt for input
            JOptionPane.showMessageDialog(null,
                    "You have no literary device! Please enter one and check again.", "Uh-oh!",
                    JOptionPane.INFORMATION_MESSAGE);
        }
    } catch (Exception e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(null,
                "Something went wrong while checking your answer! Please tell Aaron with code 130.", "Uh-oh!",
                JOptionPane.ERROR_MESSAGE);
    }
}