Example usage for javax.swing JOptionPane WARNING_MESSAGE

List of usage examples for javax.swing JOptionPane WARNING_MESSAGE

Introduction

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

Prototype

int WARNING_MESSAGE

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

Click Source Link

Document

Used for warning messages.

Usage

From source file:net.sourceforge.atunes.kernel.modules.repository.RepositoryHandler.java

/**
 * Sets the repository./*  w w  w  .j  a  v a  2s.c  o m*/
 */
public void setRepository() {
    // Try to read repository cache. If fails or not exists, should be selected again
    final Repository rep = repositoryRetrievedFromCache;
    if (rep != null) {
        if (!rep.exists()) {
            Object selection = null;
            // Test if repository exists and show message until repository exists or user doesn't press "RETRY"
            do {
                selection = VisualHandler.getInstance().showMessage(
                        StringUtils.getString(LanguageTool.getString("REPOSITORY_NOT_FOUND"), ": ",
                                rep.getFolders().get(0)),
                        LanguageTool.getString("REPOSITORY_NOT_FOUND"), JOptionPane.WARNING_MESSAGE,
                        new String[] { LanguageTool.getString("RETRY"),
                                LanguageTool.getString("SELECT_REPOSITORY") });
            } while (LanguageTool.getString("RETRY").equals(selection) && !rep.exists());

            if (!rep.exists() && !selectRepository(true)) {
                // select "old" repository if repository was not found and no new repository was selected
                repository = rep;
            } else if (rep.exists()) {
                // repository exists
                tempRepository = rep;
                notifyFinishRead(null);
            }
        } else {
            // repository exists
            tempRepository = rep;
            notifyFinishRead(null);
        }
    } else {
        // If any repository was loaded previously, try to reload folders
        List<String> lastRepositoryFolders = ApplicationState.getInstance().getLastRepositoryFolders();
        if (lastRepositoryFolders != null && !lastRepositoryFolders.isEmpty()) {
            List<File> foldersToRead = new ArrayList<File>();
            for (String f : lastRepositoryFolders) {
                foldersToRead.add(new File(f));
            }
            VisualHandler.getInstance().showMessage(LanguageTool.getString("RELOAD_REPOSITORY_MESSAGE"));
            retrieve(foldersToRead);
            return;
        }

        VisualHandler.getInstance().showRepositorySelectionInfoDialog();
        selectRepository();
    }
}

From source file:fs.MainWindow.java

public void ScatterPlot() throws IOException {
    String strfeatures = JOptionPane
            .showInputDialog("Select features " + "(columns) to scatter plot (maximum two):", "0 1");
    if (strfeatures != null) {
        StringTokenizer s = new StringTokenizer(strfeatures);
        int[] features = ExtractIndices(s);
        if (features.length == 1) {
            XScatterPlot(features[0]);//  w  w  w  . jav a 2 s.c o  m
        } else if (features.length == 2) {
            XYScatterPlot(features[0], features[1]);
        } else if (features.length == 3) {
            XYZScatterPlot(features[0], features[1], features[2]);
        } else {
            JOptionPane
                    .showMessageDialog(null,
                            "Execution Warning: The " + "implemented Scatter Plot accept at least one and a "
                                    + "maximum of two features.",
                            "Application Warning", JOptionPane.WARNING_MESSAGE);
        }
    } else {
        JOptionPane
                .showMessageDialog(null,
                        "Execution Warning: The " + "implemented Scatter Plot accept at least one and a "
                                + "maximum of two features.",
                        "Application Warning", JOptionPane.WARNING_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;

            }// w ww.j  a  v  a 2s .co m

            //                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.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;/*  w ww.  j  a v 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:frames.consulta.java

private void btneliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btneliminarActionPerformed
    int filase = tblconsulta.getSelectedRow();

    try {//from  www  .j a v  a  2s  . co  m
        String cedula, nombre, ape, edad, direccion;
        if (filase == -1) {
            JOptionPane.showMessageDialog(null, "Debe Seleccionar un Paciente", "Advertencia",
                    JOptionPane.WARNING_MESSAGE);
        } else {

            int valor = JOptionPane.showConfirmDialog(this, "Esta Seguro eliminar el paciente?",
                    "Advertencia", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
            if (valor == JOptionPane.YES_NO_OPTION) {
                JPasswordField pf = new JPasswordField();
                int okCxl = JOptionPane.showConfirmDialog(null, pf, "Enter Password",
                        JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
                if (okCxl == JOptionPane.OK_OPTION) {
                    String password = new String(pf.getPassword());
                    String cap = "", cap1 = "";
                    int id;
                    String encriptado = DigestUtils.md5Hex(password);

                    String sql = "";

                    sql = "SELECT * FROM administrador WHERE clave='" + encriptado + "'";

                    try {
                        Statement st = cn.createStatement();
                        ResultSet rs = st.executeQuery(sql);

                        while (rs.next()) {
                            id = rs.getInt("id_usuario");
                            cap = rs.getString("usuario");
                            cap1 = rs.getString("clave");
                        }

                        if (cap1.equals(encriptado)) {

                            modelo = (DefaultTableModel) tblconsulta.getModel();
                            cedula = tblconsulta.getValueAt(filase, 0).toString();
                            nombre = tblconsulta.getValueAt(filase, 1).toString();
                            ape = tblconsulta.getValueAt(filase, 2).toString();
                            edad = tblconsulta.getValueAt(filase, 3).toString();
                            direccion = tblconsulta.getValueAt(filase, 4).toString();

                            Eliminar(cedula);

                        } else {
                            JOptionPane.showMessageDialog(null, "Clave Invalida", "Advertencia",
                                    JOptionPane.WARNING_MESSAGE);

                        }
                    } catch (SQLException ex) {
                        JOptionPane.showMessageDialog(null, ex);
                        ;
                    }
                    //System.err.println("You entered: " + password);
                }
                //System.exit(0);
            }
        }
    } catch (Exception e) {
        //registro.action = "Ver";
    }
}

From source file:client.ui.FilePane.java

private void authorizationButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_authorizationButtonActionPerformed
    CloudFile selectedFile = getSelectedFile();
    if (selectedFile == null) {
        JOptionPane.showMessageDialog(this, "", "??", JOptionPane.WARNING_MESSAGE);
        return;/*from  w ww . j a v  a2 s.c  om*/
    }

    AuthorizationWindow authorizationWindow = new AuthorizationWindow(m_MainFrame);
    if (!authorizationWindow.isConfirmed()) {
        //fileInfoTable.clearSelection();
        return;
    }

    try {
        Authorization authorization = authorizationWindow.getAuthorization();
        AuthorizationResult result = m_Business.setAuthorization(selectedFile, authorization);
        switch (result) {
        case OK:
            JOptionPane.showMessageDialog(m_MainFrame, "?", "??",
                    JOptionPane.INFORMATION_MESSAGE);
            getDirectory(currentID);
            break;
        case unAuthorized:
            JOptionPane.showMessageDialog(m_MainFrame, "?", "??",
                    JOptionPane.WARNING_MESSAGE);
            m_MainFrame.setVisible(false);
            LoginDialog loginDialog = new LoginDialog(m_MainFrame, m_Business);
            break;
        case wrong:
            JOptionPane.showMessageDialog(m_MainFrame, "??", "??",
                    JOptionPane.WARNING_MESSAGE);
            getDirectory(currentID);
            break;
        default:
            JOptionPane.showMessageDialog(m_MainFrame, "", null, JOptionPane.ERROR_MESSAGE);
            break;
        }
    } catch (IOException e) {
        JOptionPane.showMessageDialog(m_MainFrame, "", "??", JOptionPane.ERROR_MESSAGE);
    }
}

From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java

/**
 * Hilfsfunktion zum start speichern/update eines Tauchlogs Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui
 * /*ww w. j  av  a  2  s  .com*/
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 12.07.2012
 * @param logListEntry
 */
private int computeLogRequest(Integer[] logListEntry) {
    // liegt ein updatewunsch vor?
    if (logListEntry[1] > 0) {
        lg.warn("dive logentry alredy there. Ask user for continue...");
        //@formatter:off
        // Zeige dem geneigten User eine Dialogbox, in welcher er entscheiden muss: Update oder berspringen
        Object[] options = { LangStrings.getString("MainCommGUI.updateWarnDialog.updateButton"),
                LangStrings.getString("MainCommGUI.updateWarnDialog.cancelButton") };
        int retOption = JOptionPane.showOptionDialog(null,
                LangStrings.getString("MainCommGUI.updateWarnDialog.messageUpdate"),
                LangStrings.getString("MainCommGUI.updateWarnDialog.headLine"), JOptionPane.DEFAULT_OPTION,
                JOptionPane.WARNING_MESSAGE, null, options, options[0]);
        //@formatter:on
        if (retOption == 1) {
            lg.info("user has cancel to update divelog entry.");
            return (0);
        } else {
            // update datensatz!
            logListPanel.setNextLogIsAnUpdate(true, logListEntry[0]);
        }
    }
    // datensatz anlegen
    wDial = new PleaseWaitDialog(LangStrings.getString("PleaseWaitDialog.title"),
            LangStrings.getString("PleaseWaitDialog.waitForReadDive"));
    wDial.setDetailMessage(
            String.format(LangStrings.getString("PleaseWaitDialog.readDiveNumber"), logListEntry[0]));
    wDial.setTimeout(90 * 1000);
    wDial.setVisible(true);
    // Sag dem SPX er soll alles schicken
    lg.debug("send command to spx: send logfile number <" + logListEntry[0] + ">");
    btComm.readLogDetailFromSPX(logListEntry[0]);
    return (1);
}

From source file:edu.ku.brc.ui.UIRegistry.java

/**
 * Displays a Warning dialog with a non-localized error message.
 * @param titleKey the title localize key
 * @param msgKey the message localize key
 * @param args any args//ww w  .  j  a v  a 2s.c om
 */
public static void showLocalizedMsg(final String msgKey) {
    showLocalizedMsg(JOptionPane.WARNING_MESSAGE, "WARNING", msgKey);
}

From source file:com.smanempat.view.ViewClassification.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    try {/*from  w  w w . j a  v  a2 s . c  o  m*/
        ControllerClassification controllerClassification = new ControllerClassification();
        controllerClassification.chooseFile(evt, txtFileDirectory, txtNumberOfK, labelJumlahData, buttonProses,
                tablePreview);

    } catch (Exception e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(this, "Problem while upload file!", "Informasi Kesalahan Upload",
                JOptionPane.WARNING_MESSAGE);
    }
}

From source file:edu.ku.brc.ui.UIRegistry.java

/**
 * Displays a Warning dialog with a non-localized error message.
 * @param titleKey the title localize key
 * @param msgKey the message localize key
 * @param args any args//from w  w  w.  ja v a  2  s .co m
 */
public static void showLocalizedMsg(final String titleKey, final String msgKey, final Object... args) {
    showLocalizedMsg(JOptionPane.WARNING_MESSAGE, titleKey, msgKey, args);
}