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:com.openbravo.pos.admin.RolesViewTree.java

/**
 *
 * @return @throws BasicException//  w w  w .j  a v  a2  s.co m
 */
@Override
public Object createValue() throws BasicException {
    Object[] role = new Object[4];
    role = new Object[4];
    role[0] = m_oId == null ? UUID.randomUUID().toString() : m_oId;
    role[1] = m_jName.getText();
    role[2] = Formats.BYTEA.parseValue(buildPermissionsStr());
    role[3] = jRightsLevel.getValue();

    if (!hasPermissions) {
        Object[] options = { AppLocal.getIntString("Button.NoPermissionsYes"),
                AppLocal.getIntString("Button.NoPermissionsNo") };
        if (JOptionPane.showOptionDialog(this,
                AppLocal.getIntString("Message.adminpermissions1") + m_jName.getText() + " "
                        + AppLocal.getIntString("Message.adminpermissions2"),
                AppLocal.getIntString("Message.adminwarning"), JOptionPane.YES_NO_OPTION,
                JOptionPane.WARNING_MESSAGE, null, options, options[1]) == 1) {
            // Re-instate original permissions for this role
            role = new Object[4];
            role[0] = m_oId == null ? UUID.randomUUID().toString() : m_oId;
            role[1] = m_jName.getText();
            role[2] = Formats.BYTEA.parseValue(m_dlAdmin.findRolePermissions(role[0].toString()));
            role[3] = m_dlAdmin.getRightsLevel(m_jName.getText());
            return role;
        }
    }
    return role;
}

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

private void verifyDataButtonActionPerformed(ActionEvent e) {
    if (ReaderContext.isFoxberryConnected() || (ReaderContext.isUsbConnected())) {
        if (userDataFrame.isVisible()) {
            userDataFrame.setVisible(false);
            ReaderContext.removeReadingListener(userDataFrame);
            ReaderContext.stopReading();
        } else {/*  ww  w . j a v  a 2 s .c  o m*/
            try {
                ReaderContext.startReading();
                ReaderContext.addReadingListener(userDataFrame);
                userDataFrame.setVisible(true);
            } catch (ReaderException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
    } else {
        JOptionPane.showConfirmDialog(this, "Se debe conectar a un lector primero", "Sin conexin a lectores",
                JOptionPane.WARNING_MESSAGE);
    }
}

From source file:jmemorize.gui.swing.frames.MainFrame.java

/**
 * If lesson was modified this shows a dialog that asks if the user wants to
 * save the lesson before closing it./*from w ww  .  ja va 2s  . c  o m*/
 * 
 * @return <code>true</code> if user chose not to cancel the lesson close
 *         operation. If this method return <code>false</code> the closing
 *         of jMemorize was canceled.
 */
public boolean allowTheUserToSaveIfClosing() {
    // first check the editCardFrame for unsaved changes
    final EditCardFrame editFrame = EditCardFrame.getInstance();
    if (editFrame.isVisible() && !editFrame.close()) {
        return false; // user canceled closing of edit card frame
    }

    if (!m_newCardManager.closeAllFrames()) // close all addCard frames
    {
        return false;
    }

    // then see if lesson should to be saved
    final Lesson lesson = m_main.getLesson();
    if (lesson.canSave()) {
        final int n = JOptionPane.showConfirmDialog(MainFrame.this, Localization.get("MainFrame.SAVE_MODIFIED"), //$NON-NLS-1$
                "Warning", //$NON-NLS-1$
                JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);

        if (n == JOptionPane.OK_OPTION) {
            try {
                jMemorizeIO.saveLesson(lesson);

                jMemorizeIO.reset();
            } catch (final Exception exception) {
                final File file = jMemorizeIO.getFile();
                final Object[] args = { file != null ? file.getName() : "?" };
                final MessageFormat form = new MessageFormat(Localization.get(LC.ERROR_SAVE));
                final String msg = form.format(args);
                Main.logThrowable(msg, exception);

                new ErrorDialog(this, msg, exception).setVisible(true);
            }
            // if lesson was saved return true, false otherwise
            return !lesson.canSave();
        }

        // if NO chosen continue, otherwise CANCEL was chosen
        return n == JOptionPane.NO_OPTION;
    }

    return true;
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.xhtml.PainelXHTML.java

/**
 * Chamado pelo TabbedXHTML//from  w ww  . j av a 2 s  .  c  o m
 * @param url
 */
public void avaliaUrl(String url) {
    PegarPaginaWEB ppw = new PegarPaginaWEB();
    if (url != null) {
        arquivo = null;
        salvaAlteracoes.setNomeDoArquivoEmDisco(null);
        //System.out.println("arquivo = null");
        try {
            String codHtml = ppw.getContent(url);
            textAreaSourceCode.setText(codHtml);
            TxtBuffer.setContentOriginal(codHtml, "0");
            reavalia(codHtml);
            this.ferrXHTMLPanelNaoEditavel.avalia(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:de.cebitec.readXplorer.differentialExpression.plot.DeSeqGraphicsTopComponent.java

private void plotButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_plotButtonActionPerformed
    try {/*w  ww  . ja  v a  2 s  . co  m*/
        messages.setText("");
        plotButton.setEnabled(false);
        saveButton.setEnabled(false);
        DeSeqAnalysisHandler.Plot selectedPlot = (DeSeqAnalysisHandler.Plot) plotType.getSelectedItem();
        if (selectedPlot == DeSeqAnalysisHandler.Plot.MAplot) {
            progressHandle.start();
            progressHandle.switchToIndeterminate();
            chartPanel = CreatePlots.createInfPlot(
                    ConvertData.createMAvalues(result, DeAnalysisHandler.Tool.DeSeq, null, null),
                    "A ((log(baseMeanA)/log(2)) + (log(baseMeanB)/log(2)))/2",
                    "M (log(baseMeanA)/log(2)) - (log(baseMeanB)/log(2))", new ToolTip());
            if (SVGCanvasActive) {
                plotPanel.remove(svgCanvas);
                SVGCanvasActive = false;
            }
            //                plotDescriptionArea.setText("A (normalized mean expression (0.5 * log2 (baseMeanA * baseMeanB))) against M (log2 fold change)");
            plotDescriptionArea.setVisible(false);
            plotPanel.add(chartPanel, BorderLayout.CENTER);
            plotPanel.repaint();
            plotPanel.updateUI();
            plotButton.setEnabled(true);
            saveButton.setEnabled(true);
            progressHandle.switchToDeterminate(100);
            progressHandle.finish();
        } else {
            plotDescriptionArea.setVisible(true);
            if (!SVGCanvasActive) {
                plotPanel.remove(chartPanel);
                plotPanel.add(svgCanvas, BorderLayout.CENTER);
                plotPanel.updateUI();
                SVGCanvasActive = true;
            }
            currentlyDisplayed = ((DeSeqAnalysisHandler) analysisHandler).plot(selectedPlot);
            svgCanvas.setURI(currentlyDisplayed.toURI().toString());
            svgCanvas.setVisible(true);
            svgCanvas.repaint();
        }
        plotDescriptionArea.repaint();
    } catch (IOException ex) {
        Date currentTimestamp = new Timestamp(Calendar.getInstance().getTime().getTime());
        Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "{0}: " + ex.getMessage(),
                currentTimestamp);
        JOptionPane.showMessageDialog(null, "Can't create the temporary svg file!", "Gnu R Error",
                JOptionPane.WARNING_MESSAGE);
    } catch (GnuR.PackageNotLoadableException ex) {
        Date currentTimestamp = new Timestamp(Calendar.getInstance().getTime().getTime());
        Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "{0}: " + ex.getMessage(),
                currentTimestamp);
        JOptionPane.showMessageDialog(null, ex.getMessage(), "Gnu R Error", JOptionPane.WARNING_MESSAGE);
    }
}

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

private void readTagButtonActionPerformed(ActionEvent e) {
    if (ReaderContext.isFoxberryConnected() || (ReaderContext.isUsbConnected())) {
        JReadTags readTag = new JReadTags(this, true);
        readTag.setVisible(true);/*  w  w  w.ja  v a 2  s .  co  m*/
    } else {
        JOptionPane.showConfirmDialog(this, "Se debe conectar a un lector primero", "Sin conexin a lectores",
                JOptionPane.WARNING_MESSAGE);
    }
}

From source file:com.openbravo.pos.imports.JPanelCSVImport.java

/**
 * Imports the CVS File using specifications from the form.
 *
 * @param CSVFileName Name of the file (including path) to import.
 * @throws IOException If there are file reading issues.
 *///from  ww w. j a  va2s  .c o m
private void ImportCsvFile(String CSVFileName) throws IOException {

    File f = new File(CSVFileName);
    if (f.exists()) {
        // Read file
        products = new CsvReader(CSVFileName);
        products.setDelimiter(((String) jComboSeparator.getSelectedItem()).charAt(0));
        products.readHeaders();

        currentRecord = 0;
        while (products.readRecord()) {
            productReference = products.get((String) jComboReference.getSelectedItem());
            productName = products.get((String) jComboName.getSelectedItem());
            productBarcode = products.get((String) jComboBarcode.getSelectedItem());
            String BuyPrice = products.get((String) jComboBuy.getSelectedItem());
            String SellPrice = products.get((String) jComboSell.getSelectedItem());
            Category = products.get((String) jComboCategory.getSelectedItem());
            currentRecord++;

            // Strip Currency Symbols
            BuyPrice = StringUtils.replaceChars(BuyPrice, "$", ""); // Remove currency symbol
            SellPrice = StringUtils.replaceChars(SellPrice, "$", ""); // Remove currency symbol

            dCategory = getCategory();

            // set the csvMessage to a default value
            if ("Bad Category".equals(dCategory)) {
                csvMessage = "Bad category details";
            } else {
                csvMessage = "Missing data or Invalid number";
            }

            // Validate and convert the prices or change them to null
            if (validateNumber(BuyPrice)) {
                productBuyPrice = Double.parseDouble(BuyPrice);
            } else {
                productBuyPrice = null;
            }

            if (validateNumber(SellPrice)) {
                productSellPrice = getSellPrice(SellPrice);
            } else {
                productSellPrice = null;
            }

            /**
             * Check to make sure our entries aren't bad or blank or the
             * category is not bad
             *
             */
            if ("".equals(productReference) | "".equals(productName) | "".equals(productBarcode)
                    | "".equals(BuyPrice) | "".equals(SellPrice) | productBuyPrice == null
                    | productSellPrice == null | "Bad Category".equals(dCategory)) {
                if (productBuyPrice == null | productSellPrice == null) {
                    badPrice++;
                } else {
                    missingData++;
                }
                createCSVEntry(csvMessage, null, null);
            } else {
                // We know that the data passes the basic checks, so get more details about the product
                recordType = getRecord();
                switch (recordType) {
                case "new":
                    createProduct("new");
                    newRecords++;
                    jTextNew.setText(Integer.toString(newRecords));
                    createCSVEntry("New product", null, null);
                    break;
                case "name error":
                case "barcode error":
                case "reference error":
                case "Duplicate Reference found.":
                case "Duplicate Barcode found.":
                case "Duplicate Description found.":
                case "Exception":
                    invalidRecords++;
                    createCSVEntry(recordType, null, null);
                    break;
                default:
                    updateRecord(recordType);
                    break;
                }
            }
        }
    } else {
        JOptionPane.showMessageDialog(null, "Unable to locate " + CSVFileName, "File not found",
                JOptionPane.WARNING_MESSAGE);
    }

    // update the record fields on the form
    jTextNew.setText(Integer.toString(newRecords));
    jTextUpdate.setText(Integer.toString(priceUpdates));
    jTextInvalid.setText(Integer.toString(invalidRecords));
    jTextMissing.setText(Integer.toString(missingData));
    jTextNoChange.setText(Integer.toString(noChanges));
    jTextBadPrice.setText(Integer.toString(badPrice));
    jTextBadCats.setText(Integer.toString(badCategories.size()));

    jImport.setEnabled(true);
}

From source file:com.edduarte.protbox.Protbox.java

private static void changeProtPath(PReg reg, File serializedDirectory) throws ProtboxException {

    if (JOptionPane.showConfirmDialog(null,
            "The prot folder from one of your registries\n" + "was deleted while Protbox wasn't running!\n"
                    + "Do you wish to set a new folder to place the decoded files from the shared folder?\n"
                    + "CHOOSING \"NO\" WILL DELETE THE REGISTRY AND YOU WILL LOSE ACCESS TO THE FILES "
                    + "IN THE SHARED FOLDER!",
            "Prot Folder was deleted!", JOptionPane.YES_NO_OPTION,
            JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
        final DirectoryChooser chooser = new DirectoryChooser("Choose Output folder...");
        String newOutputPath = chooser.getDirectory();
        if (newOutputPath != null) {
            reg.changeProtPath(newOutputPath);
        } else {//  w  ww  .j  a v  a  2  s  .com
            changeProtPath(reg, serializedDirectory);
        }

    } else {
        reg.stop();
        serializedDirectory.deleteOnExit();
    }
}

From source file:com.jvms.i18neditor.editor.Editor.java

public void showRenameTranslationDialog(String key) {
    String newKey = "";
    while (newKey != null && newKey.isEmpty()) {
        newKey = Dialogs.showInputDialog(this, MessageBundle.get("dialogs.translation.rename.title"),
                MessageBundle.get("dialogs.translation.rename.text"), JOptionPane.QUESTION_MESSAGE, key, true);
        if (newKey != null) {
            if (!ResourceKeys.isValid(newKey)) {
                showError(MessageBundle.get("dialogs.translation.rename.error"));
            } else {
                TranslationTreeNode newNode = translationTree.getNodeByKey(newKey);
                TranslationTreeNode oldNode = translationTree.getNodeByKey(key);
                if (newNode != null) {
                    boolean isReplace = newNode.isLeaf() || oldNode.isLeaf();
                    boolean confirm = Dialogs.showConfirmDialog(this,
                            MessageBundle.get("dialogs.translation.conflict.title"),
                            MessageBundle.get(
                                    "dialogs.translation.conflict.text." + (isReplace ? "replace" : "merge")),
                            JOptionPane.WARNING_MESSAGE);
                    if (confirm) {
                        renameTranslationKey(key, newKey);
                    }//ww  w .j ava 2  s.  c  o  m
                } else {
                    renameTranslationKey(key, newKey);
                }
            }
        }
    }
}

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

private void programTagButtonActionPerformed(ActionEvent e) {
    if (ReaderContext.isFoxberryConnected() || (ReaderContext.isUsbConnected())) {
        JProgramTags programTag = new JProgramTags(this, true);
        programTag.setVisible(true);//from w  ww.  j a  v a2  s. co m
    } else {
        JOptionPane.showConfirmDialog(this, "Se debe conectar a un lector primero", "Sin conexin a lectores",
                JOptionPane.WARNING_MESSAGE);
    }
}