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.mirth.connect.client.ui.Frame.java

/**
 * Alerts the user with a warning dialog with the passed in 'message'
 *///  w  ww .j  a  v a2s.  co m
public void alertWarning(Component parentComponent, String message) {
    JOptionPane.showMessageDialog(getVisibleComponent(parentComponent), message, "Warning",
            JOptionPane.WARNING_MESSAGE);
}

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

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
    l.info("Hash action activated");
    final ActionEvent ev = evt;
    if (!Shared.hashInProgress) {
        //final Game gg;
        if (jTable1.getSelectedRow() >= 0) {
            DefaultTableModel mdl = (DefaultTableModel) jTable1.getModel();
            String name = (String) mdl.getValueAt(jTable1.getSelectedRow(), 0);
            if (name != null) {
                MainFrame.lockInterface();
                SwingWorker worker = new SwingWorker<Void, Void>() {

                    @Override//from  ww  w.j av  a2 s.  c  om
                    public Void doInBackground() {
                        l.trace("Starting hashing");
                        MainFrame.lockInterface();
                        Shared.hashInProgress = true;
                        int row = jTable1.getSelectedRow();
                        String game = (String) jTable1.getModel().getValueAt(row, 0);
                        l.trace("Selection -  row: " + row + " and name " + game);
                        int status = GamelistStorage.getGame(game).gameStatus;
                        if (status == 0) {
                            File g = new File(GamelistStorage.getGame(game).gameAbsoluteFolderPath);
                            File tp = new File(SettingsManager.getTorrentFolderPath()
                                    + GamelistStorage.getGame(game).gameName + ".torrent");
                            try {
                                updateTask("Preparing to hash - wait!", true);
                                updateProgressBar(0, 0, 0, "...", false, true);
                                jButton5.setText("STOP");
                                //jButton5.setForeground(Color.RED);
                                jButton5.setEnabled(true);
                                jButton5.requestFocusInWindow();
                                MainFrame.setReportingActive();
                                GamelistStorage.getGame(game).gameStatus = 1;
                                MainFrame.updateGameInterfaceFromStorage();
                                TOTorrent t = TrackerManager.createNewTorrent(g, tp,
                                        new HashingProgressListener(game));
                                TrackerManager.getCore().addTorrentToTracker(t, tp.getAbsolutePath(),
                                        g.getAbsolutePath());
                                GamelistStorage.getGame(game).gameStatus = 2;
                                MainFrame.updateGameInterfaceFromStorage();
                                MainFrame.setReportingIdle();
                            } catch (Exception ex) {
                                l.error("Torrent create failed: " + game, ex);
                            }
                        } else if (status == 1 || status == 2) {
                            l.error("Game torrent already created");
                            int ans = JOptionPane.showConfirmDialog(null,
                                    "This game has already been hashed. Rehash?", "Hashing error",
                                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
                            if (ans == JOptionPane.OK_OPTION) {
                                GamelistStorage.getGame(game).gameStatus = 0;
                                File tp = new File(Shared.workingDirectory + Shared.torrentStoreSubDirectory
                                        + "\\" + GamelistStorage.getGame(game).gameName + ".torrent");
                                FileUtils.deleteQuietly(tp);
                                Shared.hashInProgress = false;
                                jButton5ActionPerformed(ev);
                                Shared.hashInProgress = true;
                            } else {
                                //
                            }
                        } else {
                            l.error("Game status invalid - hashing aborted");
                        }
                        return null;
                    }

                    @Override
                    public void done() {
                        MainFrame.setReportingIdle();
                        jButton5.setText("Hash selected");
                        //jButton5.setForeground(Color.WHITE);
                        MainFrame.unlockInterface();
                        Shared.hashInProgress = false;
                        MainFrame.updateGameInterfaceFromStorage();
                    }
                };
                worker.execute();
            } else {
                l.trace("Empty row - no action required");
            }
        }
    } else {
        try {
            l.trace("Stopping current hashing");
            TrackerManager.cancelNewTorrentCreation();
            int row = jTable1.getSelectedRow();
            String game = (String) jTable1.getModel().getValueAt(row, 0);
            GamelistStorage.getGame(game).gameStatus = 0;
            MainFrame.unlockInterface();
            MainFrame.updateGameInterfaceFromStorage();
        } catch (TOTorrentException ex) {
            l.info("Abort exception received as expected", ex);
        } catch (Exception ex) {
            l.error("Hash abort unexpected exception - abort failed");
        }
        jButton5.setText("Hash selected");
        jButton5.setForeground(Color.WHITE);
    }
}

From source file:com.lfv.lanzius.server.LanziusServer.java

private void menuChoiceServerStop(boolean exiting) {
    if (isSwapping)
        return;//from   w  ww  .  jav  a  2  s  . c o  m
    log.info("Menu: Stop server");
    int r = JOptionPane.YES_OPTION;
    String s = "Are you sure you want to stop the server? All terminals will be unlinked!";
    if (!exiting)
        r = JOptionPane.showConfirmDialog(frame, s, "Stop?", JOptionPane.YES_NO_OPTION,
                JOptionPane.WARNING_MESSAGE);

    if (r == JOptionPane.YES_OPTION) {

        log.info("Stopping server");

        isaStop(0);

        // Unlink all terminals
        unlinkTerminal(ALL);

        // Stop all groups
        synchronized (doc) {
            Iterator iter = doc.getRootElement().getChild("GroupDefs").getChildren().iterator();
            while (iter.hasNext()) {
                Element eg = (Element) iter.next();
                eg.setAttribute("state", "stopped");
            }
        }

        // Set all terminals to idle state
        updateTerminals(ALL, ALL);
        updateView();

        // Wait before closing terminals
        try {
            Thread.sleep(250);
        } catch (InterruptedException ex) {
        }

        // Close all terminals
        synchronized (doc) {
            Iterator iter = doc.getRootElement().getChild("TerminalDefs").getChildren().iterator();
            while (iter.hasNext()) {
                Element et = (Element) iter.next();
                if (DomTools.getAttributeBoolean(et, "online", false, false)) {
                    int tid = DomTools.getAttributeInt(et, "id", 0, true);
                    et.setAttribute("online", "false");
                    log.info("Sending close to terminal " + tid);
                    networkManager.sendSessionRequestClose(tid);
                }
            }
        }
        updateView();

        // Close server
        try {
            Thread.sleep(250);
            networkManager.stop();
            Thread.sleep(250);
            httpServer.stop();
            httpConnector.close();
            Thread.sleep(250);
        } catch (Exception ex) {
            log.warn("Stop server failed!", ex);
        }

        panel.setServerStartedDate(null);
        serverStartedDate = null;
    }
}

From source file:mondrian.gui.Workbench.java

/**
 * Display jdbc connection status warning, if connection is uncsuccessful.
 *//*w  w  w .  jav  a 2 s .  com*/
private void displayWarningOnFailedConnection() {
    if (jdbcMetaData != null && jdbcMetaData.getErrMsg() != null) {
        JOptionPane.showMessageDialog(this, getResourceConverter().getFormattedString(
                "workbench.open.schema.jdbc.error",
                "Database connection could not be done.\n{0}\nAll validations related to database will be ignored.",
                jdbcMetaData.getErrMsg()),
                getResourceConverter().getString("workbench.open.schema.jdbc.error.title", "Alert"),
                JOptionPane.WARNING_MESSAGE);
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.script.PainelScript.java

public void avaliaUrl(String url) {
    PegarPaginaWEB ppw = new PegarPaginaWEB();
    if (url != null) {
        salvaAlteracoes.setNomeDoArquivoEmDisco(null);
        try {/*from  ww  w  .  j a v a2s  .co m*/
            String codHtml = ppw.getContent(url);
            TxtBuffer.setContentOriginal(codHtml, "0");
            parentFrame.showPainelFerramentaScriptPArq(codHtml);

        } catch (HttpException e1) {
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_NAO_CONECTOU,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        } catch (Exception e1) {
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_VERIFIQUE_URL,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        }
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.objeto.PainelObjeto.java

public void avaliaUrl(String url) {
    PegarPaginaWEB ppw = new PegarPaginaWEB();
    if (url != null) {

        try {//from w w w  . j  a va2s.com
            String codHtml = ppw.getContent(url);
            TxtBuffer.setContentOriginal(codHtml, "0");
            parentFrame.showPainelFerramentaDescricaoObjetosPArq(codHtml);

        } catch (HttpException e1) {
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_NAO_CONECTOU,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        } catch (Exception e1) {
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_VERIFIQUE_URL,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        }
    }
}

From source file:ffx.ui.ModelingPanel.java

/**
 * <p>/*from   w  ww. j av a  2 s .  c o  m*/
 * deleteLogs</p>
 */
public void deleteLogs() {
    if (activeSystem != null) {
        File file = activeSystem.getFile();
        String name = file.getName();
        String dir = file.getParent();
        int i = JOptionPane.showConfirmDialog(this, "Delete all logs for " + name + " from " + dir + " ?",
                "Delete Logs", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        if (i == JOptionPane.YES_OPTION) {
            try {
                File files[] = activeSystem.getFile().getParentFile().listFiles();
                for (File f : files) {
                    name = FilenameUtils.getBaseName(f.getAbsolutePath());
                    if (FilenameUtils.wildcardMatch(f.getName(), name + ".log*")) {
                        f.delete();
                    }
                }
            } catch (Exception e) {
            }
            activeSystem.setLogFile(null);
            loadLogSettings();
        }
    }
}

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

private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
    l.info("Send to uTorrent action activated");
    /*//from w  w  w .j  ava 2 s .  com
     * readout test
    l.trace(jTable1.getModel().getValueAt(0, 0));
    l.trace(jTable1.getModel().getValueAt(0, 1));
    l.trace(jTable1.getModel().getValueAt(0, 2));
    l.trace(jTable1.getModel().getValueAt(0, 3));
    l.trace(jTable1.getModel().getValueAt(0, 4));
    l.trace(jTable1.getValueAt(0, 4));
     * 
     */
    boolean at_least_one = false;
    for (int i = 0; i < jTable1.getRowCount(); i++) {
        try {
            //can't read in value directly becuase table sometimes has null, not true or false
            Object obj = jTable1.getModel().getValueAt(i, 4);
            if (obj != null) {
                boolean on_gl = (Boolean) obj;
                if (on_gl) {
                    at_least_one = true;
                    String s = (String) jTable1.getValueAt(i, 0);
                    Game g = GamelistStorage.getGame(s);
                    if (g.gameStatus != 2) {
                        l.trace("Game " + g.gameName + " is on GL but wrong status");
                    } else {
                        l.trace("Adding game " + g.gameName);
                        String cmd = "C:\\Program Files\\uTorrent\\uTorrent.exe" + " /DIRECTORY \""
                                + g.gameAbsoluteFolderPath.substring(0, g.gameAbsoluteFolderPath.length() - 1)
                                + "\" \"" + Shared.workingDirectory + "\\Torrents\\" + g.gameName
                                + ".torrent\"";
                        l.trace("Executing command: " + cmd);
                        // TODO implement apache exec library for easier flag passing
                        Process p = Runtime.getRuntime().exec(cmd);
                    }
                }
            }
        } catch (Exception ex) {
            l.error("uTorrent call error - row " + i, ex);
        }
        if (!at_least_one) {
            JOptionPane.showMessageDialog(null, "No games on GL!", "uTorrent send error",
                    JOptionPane.WARNING_MESSAGE);
        }
    }
    // Process p = Runtime.getRuntime().exec(null)
}

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

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
    l.info("Put on GL action activated");
    int row = jTable1.getSelectedRow();
    if (jTable1.getSelectedRow() >= 0) {
        String s = (String) jTable1.getValueAt(row, 0);
        Game g = GamelistStorage.getGame(s);
        if (g.gameStatus != 2) {
            JOptionPane.showMessageDialog(this, "This game has not been hashed yet!", "Game status invalid",
                    JOptionPane.WARNING_MESSAGE);
        } else {/*from   w  w  w.jav a 2s .c o  m*/
            jTable1.getModel().setValueAt(true, row, 4);
            l.trace("Game added to GL: " + g.gameName);
        }
    } else {
        JOptionPane.showMessageDialog(null, "Select a row first", "Row operation error",
                JOptionPane.WARNING_MESSAGE);
    }
}

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

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
    l.info("Remove from GL action activated");
    int row = jTable1.getSelectedRow();
    if (jTable1.getSelectedRow() >= 0) {
        jTable1.getModel().setValueAt(false, row, 4);
    } else {// w  w w.  j a v  a 2  s  .c  om
        JOptionPane.showMessageDialog(null, "Select a row first", "Row operation error",
                JOptionPane.WARNING_MESSAGE);
    }
}