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:gda.gui.BatonPanel.java

private void btnSudoActionPerformed() {

    SwingUtilities.invokeLater(new Runnable() {
        @Override/*from   w  w w. ja v  a  2s .  com*/
        public void run() {
            getSUDialog().setVisible(true);
            getSUDialog().setLocationRelativeTo(btnSudo);
            if (getSUDialog().getAuthenticated()) {
                btnRevertUser.setEnabled(true);
                btnSudo.setEnabled(false);
                changeTitleBarString(true);

                getLblSUMessage().setText("Running as User: " + getSUDialog().getUserName());

                getPnlSUMessage().setVisible(true);

                JOptionPane.showMessageDialog(getTopLevelAncestor(),
                        "Client now operating as user " + getSUDialog().getUserName());

                updateDetails();
            } else {
                JOptionPane.showMessageDialog(getTopLevelAncestor(), "User not authenticated", "Switch User",
                        JOptionPane.WARNING_MESSAGE);
            }
        }
    });
}

From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java

public void unlinkSelectedServers() {
    final Collection<Server> selectedServers = serverList.getSelectedServers();

    final String unlinkString = "Unlink " + selectedServers.size() + " servers";
    final int result = JOptionPane.showOptionDialog(this,
            "You are about to unlink " + selectedServers.size() + " server(s).\n"
                    + "Unlinked servers are not terminated and will keep running.",
            unlinkString, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null,
            Arrays.asList(unlinkString, "Cancel").toArray(), "Cancel");

    if (result != JOptionPane.OK_OPTION) {
        return;//from ww w. j  a v  a  2  s.  c om
    }

    for (final Server server : selectedServers) {
        server.unlink();
    }

}

From source file:course_generator.param.frmEditCurve.java

/**
 * Delete the selected curve/*from w w w.j  av a2  s .  com*/
 */
protected void DeleteCurve() {
    if (!bEditMode) {
        int index = ListCurves.getSelectedIndex();
        if (index >= 0) {
            String s = Paramfile = (String) model.getElementAt(index);
            if (s.toUpperCase() != "DEFAULT") {
                Object[] options = { " " + bundle.getString("frmEditCurve.DeleteYes") + " ",
                        " " + bundle.getString("frmEditCurve.DeleteNo") + " " };
                int ret = JOptionPane.showOptionDialog(this,
                        bundle.getString("frmEditCurve.DeleteCurveMessage"),
                        bundle.getString("frmEditCurve.DeleteCurveTitle"), JOptionPane.YES_NO_OPTION,
                        JOptionPane.WARNING_MESSAGE, null, options, options[1]);

                if (ret == JOptionPane.YES_OPTION) {
                    File f = new File(Utils.GetHomeDir() + "/" + CgConst.CG_DIR + "/" + s + ".par");
                    f.delete();
                    LoadCurve(Utils.GetHomeDir() + "/" + CgConst.CG_DIR + "/default.par");
                    Paramfile = "Default";
                    RefreshView();
                    RefreshCurveList();
                }
            }
        }
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.corretor_eventos.PanelCorretorEventos.java

public void avaliaArq(String path) {
    G_File temp = new G_File(path);
    if (temp.exists()) {
        avaliaArq(temp);/*  ww w .ja  v a 2s  .com*/
    } else {
        JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_VERIFIQUE_URL, TradPainelAvaliacao.AVISO,
                JOptionPane.WARNING_MESSAGE);
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.navegacao_cego.PainelSimuladorNavegacao.java

public void avaliaUrl(String url) {
    if (url.startsWith("http")) {
        PegarPaginaWEB ppw = new PegarPaginaWEB();
        if (url != null) {
            try {
                String codHtml = ppw.getContent(url);
                System.out.println(codHtml);
                parentFrame.showPainelSimuladorNavegacaoPArq(codHtml);
                parentFrame.setTitle(url + " - " + TradSimuladorNavegacao.TITULO_SIMULADOR_CEGO);
            } catch (HttpException e1) {
                JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_NAO_CONECTOU,
                        TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
            } catch (IOException e) {
                JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_VERIFIQUE_URL,
                        TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
                e.printStackTrace();//from w  ww  .  java  2  s  .c  o  m
            } catch (Exception e1) {
                JOptionPane.showMessageDialog(this, e1.getMessage(), e1.getMessage(),
                        JOptionPane.WARNING_MESSAGE);
                e1.printStackTrace();
            }
        }
    } else {
        G_File temp = new G_File(url);
        if (temp.exists()) {
            parentFrame.showPainelSimuladorNavegacaoPArq(temp.read());
            parentFrame
                    .setTitle(temp.getFile().getName() + " - " + TradSimuladorNavegacao.TITULO_SIMULADOR_CEGO);
        } else {
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_VERIFIQUE_URL,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        }
    }
}

From source file:org.owasp.webscarab.plugin.sessionid.swing.SessionIDPanel.java

private void fetchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fetchButtonActionPerformed
    try {/*from  w  ww. j  a  v a 2  s. c o m*/
        Request request = _requestPanel.getRequest();
        if (request == null) {
            _logger.warning("Request was null in fetch request");
            return;
        }
        String name = nameTextField.getText();
        String regex = regexTextField.getText();
        int count = ((Integer) sampleSpinner.getValue()).intValue();
        try {
            _sa.fetch(request, name, regex, count);
        } catch (PatternSyntaxException pse) {
            JOptionPane.showMessageDialog(this, pse.getMessage(), "Pattern Syntax Exception",
                    JOptionPane.WARNING_MESSAGE);
        }
    } catch (MalformedURLException mue) {
        JOptionPane.showMessageDialog(this, new String[] { "The URL requested is malformed", mue.getMessage() },
                "Malformed URL", JOptionPane.ERROR_MESSAGE);
    } catch (ParseException pe) {
        JOptionPane.showMessageDialog(this, new String[] { "The request is malformed", pe.getMessage() },
                "Malformed Request", JOptionPane.ERROR_MESSAGE);
    }

}

From source file:com.brainflow.application.toplevel.Brainflow.java

private IImageDataSource specialHandling(IImageDataSource dataSource) {

    if (dataSource.getFileFormat().equals("Analyze7.5")) {
        JPanel panel = new JPanel();
        JLabel messageLabel = new JLabel("Please select correct image orientation from menu: ");
        java.util.List<Anatomy3D> choices = Anatomy3D.getInstanceList();
        JComboBox choiceBox = new JComboBox(choices.toArray());

        //todo hackery alert
        Anatomy anatomy = dataSource.getImageInfo().getAnatomy();
        choiceBox.setSelectedItem(anatomy);

        FormLayout layout = new FormLayout("4dlu, l:p, p:g, 4dlu", "6dlu, p, 10dlu, p, 6dlu");
        CellConstraints cc = new CellConstraints();
        panel.setLayout(layout);//from  w w w.j  a va  2 s .  c om
        panel.add(messageLabel, cc.xyw(2, 2, 2));
        panel.add(choiceBox, cc.xyw(2, 4, 2));

        JOptionPane.showMessageDialog(brainFrame, panel, "Analyze 7.5 image format ...",
                JOptionPane.WARNING_MESSAGE);
        Anatomy selectedAnatomy = (Anatomy) choiceBox.getSelectedItem();
        if (selectedAnatomy != anatomy) {
            //todo hackery alert
            dataSource.getImageInfo().setAnatomy((Anatomy3D) selectedAnatomy);
            dataSource.releaseData();
        }
    }

    return dataSource;

}

From source file:edu.ku.brc.specify.config.FixAttachments.java

/**
 * @param tableList/*from   w ww  . j a  v  a2s  . c o m*/
 * @param tableIdList
 * @param resultsHashMap
 * @param tblTypeHash
 * @param tableHash
 * @param totalFiles
 */
private void displayBadAttachments(final ArrayList<JTable> tableList, final ArrayList<Integer> tableIdList,
        final HashMap<Integer, Vector<Object[]>> resultsHashMap, final HashMap<Integer, String> tblTypeHash,
        final HashMap<Integer, AttchTableModel> tableHash, final int totalFiles) {
    CellConstraints cc = new CellConstraints();

    int maxWidth = 200;
    int y = 1;
    String rowDef = tableList.size() == 1 ? "f:p:g"
            : UIHelper.createDuplicateJGoodiesDef("p", "10px", tableList.size());
    PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", rowDef));
    if (tableList.size() > 1) {
        int i = 0;
        for (JTable table : tableList) {
            Integer tblId = tableIdList.get(i++);
            int numRows = table.getModel().getRowCount();

            PanelBuilder pb2 = new PanelBuilder(new FormLayout("f:p:g", "p,2px,f:p:g"));
            if (resultsHashMap.size() > 1) {
                UIHelper.calcColumnWidths(table, numRows < 15 ? numRows + 1 : 15, maxWidth);
            } else {
                UIHelper.calcColumnWidths(table, 15, maxWidth);
            }
            pb2.addSeparator(tblTypeHash.get(tblId), cc.xy(1, 1));
            pb2.add(UIHelper.createScrollPane(table), cc.xy(1, 3));
            pb.add(pb2.getPanel(), cc.xy(1, y));
            y += 2;
        }
    } else {
        UIHelper.calcColumnWidths(tableList.get(0), 15, maxWidth);
        pb.add(UIHelper.createScrollPane(tableList.get(0)), cc.xy(1, 1));
    }
    tableList.clear();

    pb.setDefaultDialogBorder();

    JScrollPane panelSB = UIHelper.createScrollPane(pb.getPanel());
    panelSB.setBorder(BorderFactory.createEmptyBorder());
    Dimension dim = panelSB.getPreferredSize();
    panelSB.setPreferredSize(new Dimension(dim.width + 10, 600));

    final int totFiles = totalFiles;
    String title = String.format("Attachment Information - %d files to recover.", totalFiles);
    CustomDialog dlg = new CustomDialog((Dialog) null, title, true, CustomDialog.OKCANCELAPPLYHELP, panelSB) {
        @Override
        protected void helpButtonPressed() {
            File file = produceSummaryReport(resultsHashMap, tableHash, totFiles);
            try {
                AttachmentUtils.openURI(file.toURI());
            } catch (Exception e) {
            }
        }

        @Override
        protected void applyButtonPressed() {
            boolean isOK = UIRegistry.displayConfirm("Clean up",
                    "Are you sure you want to remove all references to the missing attachments?", "Remove",
                    "Cancel", JOptionPane.WARNING_MESSAGE);
            if (isOK) {
                super.applyButtonPressed();
            }
        }
    };

    dlg.setCloseOnApplyClk(true);
    dlg.setCancelLabel("Skip");
    dlg.setOkLabel("Recover Files");
    dlg.setHelpLabel("Show Summary");
    dlg.setApplyLabel("Delete References");
    dlg.createUI();
    dlg.pack();

    dlg.setVisible(true);

    if (dlg.getBtnPressed() == CustomDialog.OK_BTN) {
        reattachFiles(resultsHashMap, tableHash, totalFiles);

    } else if (dlg.getBtnPressed() == CustomDialog.APPLY_BTN) {
        doAttachmentRefCleanup(resultsHashMap, tableHash, totFiles);
    }

}

From source file:org.pegadi.client.ApplicationLauncher.java

protected void login() {

    usrlabel.setText("");

    //LoginDialog loginDialog = new LoginDialog(this);
    String user = null;/*  w w  w  .j av  a2  s  .  c  o m*/
    String pass = null;
    LoginContext.sessionKey = null;
    this.requestFocus();

    try {
        do {
            loginDialog.pack();
            loginDialog.requestFocus();
            Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
            Dimension dialog = loginDialog.getSize();
            loginDialog.setLocation((screen.width - dialog.width) / 2, (screen.height - dialog.height) / 2);
            loginDialog.setVisible(true);
            user = loginDialog.getUserName();
            pass = loginDialog.getPassword();
            loginDialog.deletePassword();
            LoginContext.server = loginDialog.getServer();

            log.info("Trying to log in...");
            LoginContext.sessionKey = LoginContext.server.login(user, pass);
            log.info("Got sessionkey {}", LoginContext.sessionKey);
        } while (LoginContext.sessionKey == null);

        loginDialog.loginSuccessful();

    } catch (Exception ce) {
        JOptionPane.showMessageDialog(this, str.getString("server_down_text"),
                str.getString("server_down_title"), JOptionPane.WARNING_MESSAGE);
        log.error("Cannot connect to server", ce);
        System.exit(-1);
    }

    boolean isGod = false;
    try {
        log.debug("Checking isGod?");
        isGod = LoginContext.server.hasGlobalPermission(LoginContext.server.getUserID(LoginContext.sessionKey),
                GlobalPermissions.LEGACY_IS_GOD, LoginContext.sessionKey);

        log.debug("Is God? {}", isGod);
    } catch (Exception e) {
        log.error("error checking users privileges", e);
    }

    // running developer mode?
    isGod |= "true".equals(System.getProperty("developerMode"));

    listerButton.setEnabled(true);
    if (isGod) {
        publicationButton.setEnabled(true);
    } else {
        publicationButton.setEnabled(false);
    }
    tetrisButton.setEnabled(true);
    try {
        setLoggedinUserLabel();
    } catch (Exception le) {
        log.error("Error getting real name for user", le);
    }

    this.setVisible(true);

    loadPrefs();
    String url = null;

    try {
        url = LoginContext.server.getWebBase(LoginContext.sessionKey);
    } catch (Exception e) {
        log.error("Error getting webbase", e);
    }

    log.info("Webxml is: " + url);
    webLogin(url, user, pass);

    try {
        GetMethod get = new GetMethod(url + "/protected/");

        LoginContext.httpClient.executeMethod(get);
        log.info("HTTP Status for /protected is: " + get.getStatusCode());
    } catch (Exception e) {
        log.error("Error loggin in on web", e);
    }
}

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

final private void cannotOpenBrowserWarningMessage(final String type_type) {
    JOptionPane.showMessageDialog(this, "Cannot launch web browser for " + type_type + " data of this node",
            "Cannot launch web browser", JOptionPane.WARNING_MESSAGE);
}