Example usage for javax.swing JOptionPane PLAIN_MESSAGE

List of usage examples for javax.swing JOptionPane PLAIN_MESSAGE

Introduction

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

Prototype

int PLAIN_MESSAGE

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

Click Source Link

Document

No icon is used.

Usage

From source file:au.com.jwatmuff.eventmanager.gui.main.LoadCompetitionWindow.java

private void renameCompButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renameCompButtonActionPerformed

    selected = (DatabaseInfo) competitionList.getSelectedValue();
    if (selected == null)
        return;//from w ww . ja  va 2s . c  o  m
    if (!Main.VERSION.equals(selected.version)) {
        GUIUtils.displayError(this, "This competition is only compatible with version " + selected.version
                + ".\nThis copy of EventManager is version " + Main.VERSION + ".");
        return;
    }

    String newName = (String) JOptionPane.showInputDialog(null, "Enter a new competition name",
            "Rename Competition", JOptionPane.PLAIN_MESSAGE, null, null, selected.name);

    if (newName != null) {
        Properties props = new Properties();
        props.setProperty("UUID", "" + selected.id);
        props.setProperty("name", newName);
        props.setProperty("password", "" + selected.passwordHash);
        props.setProperty("version", selected.version);

        File infoFile = new File(selected.localDirectory, "info.dat");

        try {
            props.store(new FileOutputStream(infoFile), null);
        } catch (IOException e) {
            log.error("Unable to write database info to file", e);
        }
        checkDatabasesExecutor.schedule(checkDatabasesTask, 0, TimeUnit.MILLISECONDS);
    }
}

From source file:game.Clue.ClueGameUI.java

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
    // TODO add your handling code here:
    //Make A suggestion
    Object[] list_characters = { "MR.Green", "Mr.Peacock", "Mrs.White", "Mr.Plum", "Scarlet",
            "Colonel Mustard" };
    Object[] list_weapons = { "Candlestick", "Knife", "Wrench", "Lead Pipe", "Revolver", "Rope" };
    String m = (String) JOptionPane.showInputDialog(this, "Who do you think is the murderer?", "Solved It???",
            JOptionPane.PLAIN_MESSAGE, null, list_characters, "");
    String w = (String) JOptionPane.showInputDialog(this, "What weapon did they use?", "Solved It???",
            JOptionPane.PLAIN_MESSAGE, null, list_weapons, "");
    //String w = (String) JOptionPane.showInputDialog(this, "What was the murder weapon?","", JOptionPane.PLAIN_MESSAGE);

}

From source file:Installer.java

public void run() {
    JOptionPane optionPane = new JOptionPane(this, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION,
            null, new String[] { "Install", "Cancel" });

    emptyFrame = new Frame("Vivecraft Installer");
    emptyFrame.setUndecorated(true);/*from  www .  j ava  2 s .  c  o m*/
    emptyFrame.setVisible(true);
    emptyFrame.setLocationRelativeTo(null);
    dialog = optionPane.createDialog(emptyFrame, "Vivecraft Installer");
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setVisible(true);
    String str = ((String) optionPane.getValue());
    if (str != null && ((String) optionPane.getValue()).equalsIgnoreCase("Install")) {
        int option = JOptionPane.showOptionDialog(null,
                "Please ensure you have closed the Minecraft launcher before proceeding.\n"
                //"Also, if installing with Forge please ensure you have installed Forge " + FORGE_VERSION + " first.",
                , "Important!", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);

        if (option == JOptionPane.OK_OPTION) {
            monitor = new ProgressMonitor(null, "Installing Vivecraft...", "", 0, 100);
            monitor.setMillisToDecideToPopup(0);
            monitor.setMillisToPopup(0);

            task = new InstallTask();
            task.addPropertyChangeListener(this);
            task.execute();
        } else {
            dialog.dispose();
            emptyFrame.dispose();
        }
    } else {
        dialog.dispose();
        emptyFrame.dispose();
    }
}

From source file:org.adamkrajcik.gui.MainForm.java

private void findWinesMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findWinesMenuItemActionPerformed

    FindWinesInCellarSwingWorker findWinesSW;

    if (CellarTable.getSelectedRow() == -1) {
        JOptionPane.showConfirmDialog(null, langResource.getString("notSelectedCellarMessage"),
                langResource.getString("error"), JOptionPane.PLAIN_MESSAGE, JOptionPane.ERROR_MESSAGE);
        return;/*  www  . ja v  a  2  s. co  m*/
    }

    Cellar cellar = cellarTableModel.getCellarAtRow(CellarTable.getSelectedRow());

    //aby sa nezobrazovalo v pripade ze pivnicaje prazdna
    //FilterLabel.setText(langResource.getString("winesFilter") + " " + cellar);
    //wineFilterPanel.setVisible(true);

    findWinesMenuItem.setEnabled(false);
    findWinesSW = new FindWinesInCellarSwingWorker(cellar);
    findWinesSW.execute();
}

From source file:com.vgi.mafscaling.ClosedLoop.java

protected void loadLogFile() {
    fileChooser.setMultiSelectionEnabled(true);
    if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this))
        return;/* w  w  w. j av  a2 s  .c  o m*/
    boolean isPolSet = polfTable.isSet();
    File[] files = fileChooser.getSelectedFiles();
    for (File file : files) {
        BufferedReader br = null;
        try {
            br = new BufferedReader(new FileReader(file.getAbsoluteFile()));
            String line = br.readLine();
            if (line != null) {
                String[] elements = line.split("(\\s*)?,(\\s*)?", -1);
                getColumnsFilters(elements);

                boolean resetColumns = false;
                if (logClOlStatusColIdx >= 0 || logAfLearningColIdx >= 0 || logAfCorrectionColIdx >= 0
                        || logAfrColIdx >= 0 || logRpmColIdx >= 0 || logLoadColIdx >= 0 || logTimeColIdx >= 0
                        || logMafvColIdx >= 0 || logIatColIdx >= 0) {
                    if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null,
                            "Would you like to reset column names or filter values?", "Columns/Filters Reset",
                            JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE))
                        resetColumns = true;
                }

                if (resetColumns || logClOlStatusColIdx < 0 || logAfLearningColIdx < 0
                        || logAfCorrectionColIdx < 0 || logAfrColIdx < 0 || logRpmColIdx < 0
                        || logLoadColIdx < 0 || logTimeColIdx < 0 || logMafvColIdx < 0 || logIatColIdx < 0) {
                    ColumnsFiltersSelection selectionWindow = new CLColumnsFiltersSelection(isPolSet);
                    if (!selectionWindow.getUserSettings(elements) || !getColumnsFilters(elements))
                        return;
                }

                String[] flds;
                line = br.readLine();
                int clol;
                int i = 2;
                int row = getLogTableEmptyRow();
                double afr = 0;
                double dVdt = 0;
                double prevTime = 0;
                double time = 0;
                double timeMultiplier = 1.0;
                double pmafv = 0;
                double mafv = 0;
                double load;
                double iat;
                setCursor(new Cursor(Cursor.WAIT_CURSOR));

                while (line != null) {
                    flds = line.split(",", -1);
                    try {
                        // Calculate dV/dt
                        prevTime = time;
                        time = Double.valueOf(flds[logTimeColIdx]);
                        if (timeMultiplier == 1.0 && (int) time - time < 0) {
                            timeMultiplier = 1000.0;
                            prevTime *= timeMultiplier;
                        }
                        time *= timeMultiplier;
                        pmafv = mafv;
                        mafv = Double.valueOf(flds[logMafvColIdx]);
                        if ((time - prevTime) == 0.0)
                            dVdt = 100.0;
                        else
                            dVdt = Math.abs(((mafv - pmafv) / (time - prevTime)) * 1000.0);
                        clol = Integer.valueOf(flds[logClOlStatusColIdx]);
                        if (clol == clValue) {
                            // Filters
                            afr = Double.valueOf(flds[logAfrColIdx]);
                            load = Double.valueOf(flds[logLoadColIdx]);
                            iat = Double.valueOf(flds[logIatColIdx]);
                            if (afrMin <= afr && afr <= afrMax && minLoad <= load && dVdt <= maxDvDt
                                    && maxMafV >= mafv && maxIat >= iat) {
                                Utils.ensureRowCount(row + 1, logDataTable);
                                logDataTable.setValueAt(time, row, 0);
                                logDataTable.setValueAt(load, row, 1);
                                logDataTable.setValueAt(Double.valueOf(flds[logRpmColIdx]), row, 2);
                                logDataTable.setValueAt(mafv, row, 3);
                                logDataTable.setValueAt(afr, row, 4);
                                logDataTable.setValueAt(Double.valueOf(flds[logAfCorrectionColIdx]), row, 5);
                                logDataTable.setValueAt(Double.valueOf(flds[logAfLearningColIdx]), row, 6);
                                logDataTable.setValueAt(dVdt, row, 7);
                                logDataTable.setValueAt(iat, row, 8);
                                row += 1;
                            }
                        }
                    } catch (NumberFormatException e) {
                        logger.error(e);
                        JOptionPane.showMessageDialog(null,
                                "Error parsing number at " + file.getName() + " line " + i + ": " + e,
                                "Error processing file", JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    line = br.readLine();
                    i += 1;
                }
            }
        } catch (Exception e) {
            logger.error(e);
            JOptionPane.showMessageDialog(null, e, "Error opening file", JOptionPane.ERROR_MESSAGE);
        } finally {
            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    logger.error(e);
                }
            }
        }
    }
}

From source file:org.adamkrajcik.gui.MainForm.java

private void deleteCellarMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteCellarMenuItemActionPerformed
    DeleteCellarSwingWorker deleteCellarSW;

    if (CellarTable.getSelectedRow() == -1) {
        JOptionPane.showConfirmDialog(null, langResource.getString("notSelectedCellarMessage"),
                langResource.getString("error"), JOptionPane.PLAIN_MESSAGE, JOptionPane.ERROR_MESSAGE);
        return;//  w w  w.  j  av a  2  s.c om
    }

    Cellar cellar = cellarTableModel.getCellarAtRow(CellarTable.getSelectedRow());
    Object[] message = { langResource.getString("deleteCellarMessage"), cellar.toString() };
    int option = JOptionPane.showConfirmDialog(null, message, langResource.getString("deleteCellarTitle"),
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    if (option == JOptionPane.OK_OPTION) {
        deleteCellarMenuItem.setEnabled(false);
        deleteCellarSW = new DeleteCellarSwingWorker(cellar);
        deleteCellarSW.execute();
    }
}

From source file:velocitekProStartAnalyzer.MainWindow.java

private String showSetStartTimeDialog() {
    Object[] hoursInPoints = {};/*w ww.j  a  v  a 2 s  .com*/

    String time = "Checking";
    for (PointDto pointDto : JDBCPointDao.points) {
        if (!time.equals(
                pointDto.getPointDateHHmmss().substring(0, pointDto.getPointDateHHmmss().length() - 3))) {
            time = pointDto.getPointDateHHmmss();
            time = time.substring(0, time.length() - 3);
            hoursInPoints = appendValue(hoursInPoints, time);
        }

    }

    String s = (String) JOptionPane.showInputDialog(frame, "Choose start time:\n" + "hh:mm", "Time Chooser",
            JOptionPane.PLAIN_MESSAGE, null, hoursInPoints, null);
    return s;

}

From source file:velocitekProStartAnalyzer.MainWindow.java

private String showSetEndTimeDialog() {
    Object[] hoursInPoints = {};/*from  ww w.j a v  a2 s.  c  o m*/

    String time = "Checking";
    for (PointDto pointDto : JDBCPointDao.points) {
        if (!time.equals(
                pointDto.getPointDateHHmmss().substring(0, pointDto.getPointDateHHmmss().length() - 3))) {
            time = pointDto.getPointDateHHmmss();
            time = time.substring(0, time.length() - 3);
            hoursInPoints = appendValue(hoursInPoints, time);
        }

    }

    String s = (String) JOptionPane.showInputDialog(frame, "Choose end time:\n" + "hh:mm", "Set end time",
            JOptionPane.PLAIN_MESSAGE, null, hoursInPoints, null);
    return s;

}

From source file:velocitekProStartAnalyzer.MainWindow.java

private int selectHowManyTimes() {
    Object[] valuesOfTimes = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    int number = (int) JOptionPane.showInputDialog(frame, "How many times do you want to execute the process?",
            "Set number of times", JOptionPane.PLAIN_MESSAGE, null, valuesOfTimes, null);
    return number;
}

From source file:com.freedomotic.jfrontend.MainWindow.java

private void mnuSelectEnvironmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSelectEnvironmentActionPerformed
    if (auth.isPermitted("environments:read")) {

        if (api.environments().findAll().size() == 1) {
            drawer.setCurrEnv(api.environments().findAll().get(0));
            setMapTitle(api.environments().findAll().get(0).getPojo().getName());
        } else {//w w w . j av  a  2s  . c  o m
            Object[] possibilities = api.environments().findAll().toArray();
            EnvironmentLogic input = (EnvironmentLogic) JOptionPane.showInputDialog(this,
                    i18n.msg("select_env"), i18n.msg("select_env_title"), JOptionPane.PLAIN_MESSAGE, null,
                    possibilities, drawer.getCurrEnv());

            //If a string was returned
            if (input != null) {
                setEnvironment(input);
            } else {
                setEnvironment(api.environments().findAll().get(0));
            }
        }
    }
}