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:ca.uviccscu.lp.server.main.MainFrame.java

private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
    String s = jTextField1.getText();
    if (SettingsManager.verifyClientGameFolder(s) == 0) {
        SettingsManager.getStorage().removeCfgValue("clientgamefolder");
        SettingsManager.getStorage().putCfgValue("clientgamefolder", jTextField1.getText());
        jTextField2.setText(jTextField1.getText());
    } else {// w w  w .j  a  v  a2  s .co m
        JOptionPane.showMessageDialog(null, "Client game folder invalid", "Property set error",
                JOptionPane.WARNING_MESSAGE);
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.label.PainelLabel.java

public void avaliaUrl(String url) {
    PegarPaginaWEB ppw = new PegarPaginaWEB();
    if (url != null) {
        salvaAlteracoes.setNomeDoArquivoEmDisco(null);
        try {//from   www .  j  a va2 s  .co  m
            String codHtml = ppw.getContent(url);
            TxtBuffer.setContentOriginal(codHtml, "0");
            parentFrame.showPainelFerramentaLabelPArq(codHtml);
        } catch (HttpException e1) {
            e1.printStackTrace();
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_NAO_CONECTOU,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        } catch (Exception e1) {
            e1.printStackTrace();
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_VERIFIQUE_URL,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        }
    }
}

From source file:ca.uviccscu.lp.server.main.MainFrame.java

private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
    l.info("Show torrent folder action activated");
    File f = new File(SettingsManager.getTorrentFolderPath());
    if (f.isDirectory()) {
        try {//  w  ww .  ja  v  a2s. c o m
            if (Desktop.isDesktopSupported()) {
                l.trace("System supported - opening");
                Desktop.getDesktop().open(f);
            } else {
                JOptionPane.showMessageDialog(null, "OS is not supported - open manually", "OS error",
                        JOptionPane.WARNING_MESSAGE);
            }
        } catch (Exception ex) {
            l.error("Opening folder exception", ex);
        }
    } else {
        JOptionPane.showMessageDialog(null, "Folder doesn't exist, likely because no games have been hashed",
                "OS error", JOptionPane.WARNING_MESSAGE);
    }
}

From source file:org.forester.archaeopteryx.TreePanel.java

final void midpointRoot() {
    if ((_phylogeny == null) || (_phylogeny.getNumberOfExternalNodes() < 2)) {
        return;//from   w  w  w . j a v  a  2  s  . c  o m
    }
    if (!_phylogeny.isRerootable()) {
        JOptionPane.showMessageDialog(this, "This is not rerootable", "Not rerootable",
                JOptionPane.WARNING_MESSAGE);
        return;
    }
    setWaitCursor();
    PhylogenyMethods.midpointRoot(_phylogeny);
    resetNodeIdToDistToLeafMap();
    setArrowCursor();
    repaint();
}

From source file:Form.Principal.java

private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
    try {/*from  w ww . j av  a  2 s .co  m*/
        String Comando = null;
        if (jTextField3.getText().equalsIgnoreCase("") || jTextField5.getText().equalsIgnoreCase("")
                || jTextField6.getText().equalsIgnoreCase("") || jTextField7.getText().equalsIgnoreCase("")
                || jTextField8.getText().equalsIgnoreCase("") || jTextField9.getText().equalsIgnoreCase("")
                || jTextField10.getText().equalsIgnoreCase("") || jTextField11.getText().equalsIgnoreCase("")) {
            Object[] options = { "Aceptar" };
            JOptionPane.showOptionDialog(null, "Datos incompletos", "Aviso", JOptionPane.DEFAULT_OPTION,
                    JOptionPane.WARNING_MESSAGE, null, options, options[0]);
        } else {
            Variables.NombreCliente = jTextField6.getText();
            Variables.Direccion = jTextField10.getText();
            Variables.Estado = jTextField7.getText();
            Variables.municipio = jTextField9.getText();
            Variables.delegacion = jTextField11.getText();
            Variables.Correo = jTextField3.getText();
            Variables.codpostal = jTextField8.getText();

            Comando = "UPDATE cliente SET NombreCliente='" + jTextField6.getText() + "',Direccion='"
                    + jTextField10.getText() + "',Estado='" + jTextField7.getText() + "',Municipio='"
                    + jTextField9.getText() + "',Localidad='" + jTextField11.getText() + "',codPostal='"
                    + jTextField8.getText() + "',correo='" + jTextField3.getText() + "' WHERE idCliente="
                    + Variables.idCliente + ";";
            Funcion.Update(st, Comando);

            Variables.Comentario = jTextField20.getText();
            //*******Limpiar
            jTextField5.setText("");
            jTextField6.setText("");
            jTextField10.setText("");
            jTextField8.setText("");
            jTextField9.setText("");
            jTextField7.setText("");
            jTextField3.setText("");
            jTextField11.setText("");
            jTextField20.setText("");
            jPanel7.setVisible(false);
            jButton2.setVisible(false);
            jPanel6.setVisible(false);
            jButton1.setVisible(false);
            jButton12.setVisible(false);
            jButton13.setVisible(false);
            jPanel13.setVisible(false);

            //jButton9.setVisible(true);
            //jButton10.setVisible(true);
            jButton3.setVisible(true);
            jButton11.setVisible(true);
            EnviarSAT.setVisible(true);
            CrearPanelPDF();
        }
    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, e);
        System.out.print(e.getMessage());
        e.printStackTrace();
    }

}

From source file:net.sf.jabref.gui.BasePanel.java

private void changeType(List<BibEntry> entries, String newType) {
    if ((entries == null) || (entries.isEmpty())) {
        LOGGER.error("At least one entry must be selected to be able to change the type.");
        return;/*from   w w  w .ja va 2s .  c  o m*/
    }

    if (entries.size() > 1) {
        int choice = JOptionPane.showConfirmDialog(this, Localization.lang(
                "Multiple entries selected. Do you want to change the type of all these to '%0'?", newType),
                Localization.lang("Change entry type"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        if (choice == JOptionPane.NO_OPTION) {
            return;
        }
    }

    NamedCompound compound = new NamedCompound(Localization.lang("Change entry type"));
    for (BibEntry entry : entries) {
        compound.addEdit(new UndoableChangeType(entry, entry.getType(), newType));
        entry.setType(newType);
    }

    output(formatOutputMessage(Localization.lang("Changed type to '%0' for", newType), entries.size()));
    compound.end();
    getUndoManager().addEdit(compound);
    markBaseChanged();
    updateEntryEditorIfShowing();
}

From source file:com.nikonhacker.gui.EmulatorUI.java

private void openAnalyseDialog(final int chip) {
    JTextField optionsField = new JTextField();
    JTextField destinationField = new JTextField();

    // compute and try default names for options file.
    // In order : <firmware>.dfr.txt , <firmware>.txt , dfr.txt (or the same for dtx)
    File optionsFile = new File(imageFile[chip].getParentFile(),
            FilenameUtils.getBaseName(imageFile[chip].getAbsolutePath())
                    + ((chip == Constants.CHIP_FR) ? ".dfr.txt" : ".dtx.txt"));
    if (!optionsFile.exists()) {
        optionsFile = new File(imageFile[chip].getParentFile(),
                FilenameUtils.getBaseName(imageFile[chip].getAbsolutePath()) + ".txt");
        if (!optionsFile.exists()) {
            optionsFile = new File(imageFile[chip].getParentFile(),
                    ((chip == Constants.CHIP_FR) ? "dfr.txt" : "dtx.txt"));
            if (!optionsFile.exists()) {
                optionsFile = null;//w w  w.  j a v  a2 s  .com
            }
        }
    }
    if (optionsFile != null) {
        optionsField.setText(optionsFile.getAbsolutePath());
    }

    // compute default name for output
    File outputFile = new File(imageFile[chip].getParentFile(),
            FilenameUtils.getBaseName(imageFile[chip].getAbsolutePath()) + ".asm");
    destinationField.setText(outputFile.getAbsolutePath());

    final JCheckBox writeOutputCheckbox = new JCheckBox("Write disassembly to file");

    final FileSelectionPanel destinationFileSelectionPanel = new FileSelectionPanel("Destination file",
            destinationField, false);
    destinationFileSelectionPanel.setFileFilter(".asm", "Assembly language file (*.asm)");
    writeOutputCheckbox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean writeToFile = writeOutputCheckbox.isSelected();
            destinationFileSelectionPanel.setEnabled(writeToFile);
            prefs.setWriteDisassemblyToFile(chip, writeToFile);
        }
    });

    writeOutputCheckbox.setSelected(prefs.isWriteDisassemblyToFile(chip));
    destinationFileSelectionPanel.setEnabled(prefs.isWriteDisassemblyToFile(chip));

    FileSelectionPanel fileSelectionPanel = new FileSelectionPanel(
            (chip == Constants.CHIP_FR) ? "Dfr options file" : "Dtx options file", optionsField, false);
    fileSelectionPanel.setFileFilter((chip == Constants.CHIP_FR) ? ".dfr.txt" : ".dtx.txt",
            (chip == Constants.CHIP_FR) ? "Dfr options file (*.dfr.txt)" : "Dtx options file (*.dtx.txt)");
    final JComponent[] inputs = new JComponent[] {
            //new FileSelectionPanel("Source file", sourceFile, false, dependencies),
            fileSelectionPanel, writeOutputCheckbox, destinationFileSelectionPanel,
            makeOutputOptionCheckBox(chip, OutputOption.STRUCTURE, prefs.getOutputOptions(chip), true),
            makeOutputOptionCheckBox(chip, OutputOption.ORDINAL, prefs.getOutputOptions(chip), true),
            makeOutputOptionCheckBox(chip, OutputOption.PARAMETERS, prefs.getOutputOptions(chip), true),
            makeOutputOptionCheckBox(chip, OutputOption.INT40, prefs.getOutputOptions(chip), true),
            makeOutputOptionCheckBox(chip, OutputOption.MEMORY, prefs.getOutputOptions(chip), true),
            new JLabel("(hover over the options for help. See also 'Tools/Options/Disassembler output')",
                    SwingConstants.CENTER) };

    if (JOptionPane.OK_OPTION == JOptionPane.showOptionDialog(this, inputs, "Choose analyse options",
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, JOptionPane.DEFAULT_OPTION)) {
        String outputFilename = writeOutputCheckbox.isSelected() ? destinationField.getText() : null;
        boolean cancel = false;
        if (outputFilename != null) {
            if (new File(outputFilename).exists()) {
                if (JOptionPane.showConfirmDialog(this,
                        "File '" + outputFilename + "' already exists.\nDo you really want to overwrite it ?",
                        "File exists", JOptionPane.YES_NO_OPTION,
                        JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION) {
                    cancel = true;
                }
            }
        }
        if (!cancel) {
            AnalyseProgressDialog analyseProgressDialog = new AnalyseProgressDialog(this,
                    framework.getPlatform(chip).getMemory());
            analyseProgressDialog.startBackgroundAnalysis(chip, optionsField.getText(), outputFilename);
            analyseProgressDialog.setVisible(true);
        }
    }
}

From source file:com.osparking.attendant.AttListForm.java

private void multiFuncButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiFuncButtonActionPerformed
    String[] errorMsg = new String[1];

    try {// ww  w  . j  a va  2 s  .c  o  m
        switch (formMode) {
        case NormalMode:
            // <editor-fold defaultstate="collapsed" desc="-- Prepare to update user information">
            setFormMode(FormMode.UpdateMode);
            multiFuncButton.setText(SAVE_BTN.getContent());
            multiFuncButton.setEnabled(false);
            multiFuncButton.setMnemonic('s');
            setModificationState(true); // change to modification mode
            createButton.setEnabled(false);
            deleteButton.setEnabled(false);
            break;
        // </editor-fold>                
        case UpdateMode:
            // <editor-fold defaultstate="collapsed" desc="-- save modified user information ">
            if (allFieldsAreGood(errorMsg)) {
                // each field satisfies data requirements
                setFormMode(FormMode.NormalMode);
                multiFuncButton.setText(MODIFY_BTN.getContent());
                multiFuncButton.setMnemonic('m');
                setModificationState(false);
                int result = saveUpdatedRecord();
                doAfterUpdateOperations(result);
            } else {
                if (errorMsg[0].length() > 0) {
                    showMessageDialog(this, errorMsg[0]);
                }
            }
            break;
        // </editor-fold>
        case CreateMode:
            // <editor-fold defaultstate="collapsed" desc="-- Complete user creation operation">
            if (!ID_usable) {
                JOptionPane.showConfirmDialog(this, ID_CHECK_DIALOG.getContent(),
                        CREATTION_FAIL_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE);
                return;
            }
            if (!Email_usable) {
                JOptionPane.showConfirmDialog(this, EMAIL_CHECK_DIALOG.getContent(),
                        CREATTION_FAIL_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE);
                return;
            }
            if (allFieldsAreGood(errorMsg)) {
                String newUserID = userIDText.getText().trim();
                int result = saveCreatedRecord();
                String dialogText = "";

                if (result == 1) { // 1 record inserted == insertion success.
                    // <editor-fold defaultstate="collapsed" desc="-- Refresh user list while maintaining sort order">            
                    List sortKeys = usersTable.getRowSorter().getSortKeys();
                    /**
                     * List newly created user on the list in any case.
                     */
                    loadAttendantTable(newUserID);
                    usersTable.getRowSorter().setSortKeys(sortKeys);

                    int selectIndex = searchRow(newUserID);

                    if (selectIndex < 0)
                        selectIndex = 0;
                    usersTable.changeSelection(selectIndex, 0, false, false);
                    usersTable.requestFocus();
                    changeFieldButtonUsability(selectIndex);
                    // </editor-fold>   
                    revokeCreationMode();
                    dialogText = ATT_CREATE_DIAG_1.getContent() + System.lineSeparator()
                            + ATT_CREATE_DIAG_2.getContent() + newUserID;

                    JOptionPane.showMessageDialog(this, dialogText, CREATION_RESULT_DIALOGTITLE.getContent(),
                            JOptionPane.PLAIN_MESSAGE);
                } else {
                    dialogText = ATT_FAILED_DIAG_1.getContent() + System.lineSeparator()
                            + ATT_CREATE_DIAG_2.getContent() + newUserID;

                    showMessageDialog(this, dialogText, CREATION_RESULT_DIALOGTITLE.getContent(),
                            JOptionPane.PLAIN_MESSAGE);
                }
            } else {
                if (errorMsg[0].length() > 0) {
                    showMessageDialog(this, errorMsg[0], USER_FIELD_CHECK_RESULT.getContent(),
                            JOptionPane.WARNING_MESSAGE);
                }
            }
            break;
        // </editor-fold>
        default:
        }
    } catch (Exception ex) {
        logParkingException(Level.SEVERE, ex, "(User requested command: " + evt.getActionCommand() + ")");
    }
}

From source file:com.nikonhacker.gui.EmulatorUI.java

private void openLoadImageDialog(final int chip) {
    final JFileChooser fc = new JFileChooser();
    fc.setFileFilter(new FileFilter() {
        @Override//from  w  ww .  j  a  va 2  s .  c o  m
        public boolean accept(File f) {
            if (f != null) {
                //noinspection SimplifiableIfStatement
                if (f.isDirectory()) {
                    return true;
                }
                return f.getName().toLowerCase().startsWith((chip == Constants.CHIP_FR) ? "b" : "a")
                        && f.getName().toLowerCase().endsWith(".bin");
            }
            return false;
        }

        @Override
        public String getDescription() {
            return Constants.CHIP_LABEL[chip] + " firmware file (" + ((chip == Constants.CHIP_FR) ? "b" : "a")
                    + "*.bin)";
        }
    });
    fc.setCurrentDirectory(new File("."));

    int returnVal = fc.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        final File firmwareFile = fc.getSelectedFile();
        if (firmwareFile.exists()) {
            imageFile[chip] = firmwareFile;
            reset(chip);
        } else {
            JOptionPane
                    .showMessageDialog(this,
                            "Given " + Constants.CHIP_LABEL[chip] + " firmware file does not exist:\n"
                                    + firmwareFile.getAbsolutePath(),
                            "File not found", JOptionPane.WARNING_MESSAGE);
        }
    }
}

From source file:Form.Principal.java

private void jButtonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveActionPerformed
    try {//ww w  . j  a  va 2 s .  c o m
        String Comando = null;
        if (jTextField12.getText().equalsIgnoreCase("") || jTextField13.getText().equalsIgnoreCase("")
                || jTextField14.getText().equalsIgnoreCase("") || jTextField15.getText().equalsIgnoreCase("")
                || jTextField18.getText().equalsIgnoreCase("") || jTextField17.getText().equalsIgnoreCase("")
                || jTextField16.getText().equalsIgnoreCase("") || jTextField4.getText().equalsIgnoreCase("")) {
            Object[] options = { "Aceptar" };
            JOptionPane.showOptionDialog(null, "Datos incompletos", "Aviso", JOptionPane.DEFAULT_OPTION,
                    JOptionPane.WARNING_MESSAGE, null, options, options[0]);
        } else {
            Variables.RFC = jTextField12.getText();
            Variables.NombreCliente = jTextField14.getText();
            Variables.Direccion = jTextField13.getText();
            Variables.Estado = jTextField15.getText();
            Variables.municipio = jTextField17.getText();
            Variables.delegacion = jTextField18.getText();
            Variables.Correo = jTextField4.getText();
            Variables.codpostal = jTextField16.getText();

            Comando = "UPDATE cliente SET NombreCliente='" + jTextField14.getText() + "',Direccion='"
                    + jTextField13.getText() + "',Estado='" + jTextField15.getText() + "',Municipio='"
                    + jTextField17.getText() + "',Localidad='" + jTextField18.getText() + "',codPostal='"
                    + jTextField16.getText() + "',correo='" + jTextField4.getText() + "',RFC='"
                    + jTextField12.getText() + "' WHERE idCliente=" + id + ";";
            Funcion.Update(st, Comando);
            Variables.Comentario = jTextField21.getText();

            if (editarcliente2 == false)
                botonfalse();
            else {
                jTextField12.setText("");
                jTextField14.setText("");
                jTextField13.setText("");
                jTextField15.setText("");
                jTextField17.setText("");
                jTextField18.setText("");
                jTextField16.setText("");
                jTextField4.setText("");
                jTextField21.setText("");
                EditarClientes.remove(scrollcuadro);
                jPanel9.setVisible(false);
                EnviarSAT1.setVisible(true);
                jButton18.setVisible(true);
                jButton15.setVisible(true);
                scrollcuadro.setVisible(true);
                jButtonSave.setVisible(false);
                jButton16.setVisible(false);
                jPanel14.setVisible(false);
                CrearPanelPDF();
            }
            editarcliente2 = false;
        }
    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, e);
        System.out.print(e.getMessage());
        e.printStackTrace();
    }

}