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:view.CertificateManagementDialog.java

private String getUserInputPassword() {
    JPanel panel = new JPanel();
    JLabel lblInsertPassword = new JLabel(Bundle.getBundle().getString("insertKeystorePassword"));
    JPasswordField pf = new JPasswordField(10);
    panel.add(lblInsertPassword);//from ww w. j a  v a2 s. co m
    panel.add(pf);
    String[] options = new String[] { Bundle.getBundle().getString("btn.ok"),
            Bundle.getBundle().getString("btn.cancel") };
    int option = JOptionPane.showOptionDialog(null, panel, null, JOptionPane.NO_OPTION,
            JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
    if (option == JOptionPane.OK_OPTION) {
        char[] password = pf.getPassword();
        return new String(password);
    }
    return null;
}

From source file:xmlconverter.tools.ErrorHandling.java

public void showInfo(String message) {
    int opt = JOptionPane.showConfirmDialog(frame, message, "Tree is not ready to be shown!",
            JOptionPane.PLAIN_MESSAGE);
}

From source file:xtrememp.update.SoftwareUpdate.java

public static void showCheckForUpdatesDialog() {
    checkForUpdatesDialog = new JDialog(XtremeMP.getInstance().getMainFrame(), tr("Dialog.SoftwareUpdate"),
            true);/*  w ww  .j a va2 s  . c o  m*/
    JPanel panel = new JPanel(new BorderLayout(0, 10));
    panel.add(new JLabel(tr("Dialog.SoftwareUpdate.CheckingForUpdates")), BorderLayout.CENTER);
    JProgressBar progressBar = new JProgressBar();
    progressBar.setIndeterminate(true);
    progressBar.setPreferredSize(new Dimension(250, 20));
    panel.add(progressBar, BorderLayout.SOUTH);
    JButton cancelButton = new JButton(tr("Button.Cancel"));
    cancelButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (checkForUpdatesWorker != null && !checkForUpdatesWorker.isDone()) {
                checkForUpdatesWorker.cancel(true);
            }
            checkForUpdatesDialog.dispose();
        }
    });
    JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null,
            new Object[] { cancelButton }, cancelButton);
    checkForUpdatesDialog.setContentPane(optionPane);
    checkForUpdatesDialog.pack();
    checkForUpdatesDialog.setResizable(false);
    checkForUpdatesDialog.setLocationRelativeTo(checkForUpdatesDialog.getParent());
    checkForUpdatesDialog.getRootPane().setDefaultButton(cancelButton);
    checkForUpdatesDialog.setVisible(true);
}

From source file:xtrememp.XtremeMP.java

@Override
public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();

    if (source == openMenuItem) {
        playlistManager.addFilesDialog(true);
    } else if (source == openURLMenuItem) {
        String url = JOptionPane.showInputDialog(mainFrame, tr("Dialog.OpenURL.Message"), tr("Dialog.OpenURL"),
                JOptionPane.INFORMATION_MESSAGE);
        if (url != null && Utilities.startWithProtocol(url)) {
            boolean isPlaylistFile = false;
            for (String ext : PlaylistFileFilter.PlaylistFileExt) {
                if (url.endsWith(ext)) {
                    isPlaylistFile = true;
                }//from  w  w w . ja  v a2 s .  co  m
            }
            if (isPlaylistFile) {
                playlistManager.clearPlaylist();
                playlistManager.loadPlaylist(url);
                playlist.begin();
            } else {
                PlaylistItem newPli = new PlaylistItem(url, url, -1, false);
                playlistManager.add(newPli);
                playlist.setCursor(newPli);
            }
            acOpenAndPlay();
        }
    } else if (source == openPlaylistMenuItem) {
        playlistManager.openPlaylistDialog();
    } else if (source == savePlaylistMenuItem) {
        playlistManager.savePlaylistDialog();
    } else if (source == preferencesMenuItem) {
        PreferencesDialog preferencesDialog = new PreferencesDialog(audioPlayer, this);
        preferencesDialog.setVisible(true);
    } else if (source == exitMenuItem) {
        exit();
    } else if (source == playPauseMenuItem || source == playPauseButton) {
        acPlayPause();
    } else if (source == previousMenuItem || source == previousButton) {
        acPrevious();
    } else if (source == nextMenuItem || source == nextButton) {
        acNext();
    } else if (source == randomizePlaylistMenuItem) {
        playlistManager.randomizePlaylist();
    } else if (source == stopMenuItem || source == stopButton) {
        acStop();
    } else if (source == playlistManagerMenuItem) {
        if (visualizationManager.isVisible()) {
            visualizationManager.setDssEnabled(false);
            CardLayout cardLayout = (CardLayout) (mainPanel.getLayout());
            cardLayout.show(mainPanel, Utilities.PLAYLIST_MANAGER);
            playlistManagerMenuItem.setSelected(true);
            Settings.setLastView(Utilities.PLAYLIST_MANAGER);
        }
    } else if (source == visualizationMenuItem) {
        if (playlistManager.isVisible()) {
            visualizationManager.setDssEnabled(true);
            CardLayout cardLayout = (CardLayout) (mainPanel.getLayout());
            cardLayout.show(mainPanel, Utilities.VISUALIZATION_PANEL);
            visualizationMenuItem.setSelected(true);
            Settings.setLastView(Utilities.VISUALIZATION_PANEL);
        }
    } else if (source == updateMenuItem) {
        SoftwareUpdate.checkForUpdates(true);
        SoftwareUpdate.showCheckForUpdatesDialog();
    } else if (source == aboutMenuItem) {
        Object[] options = { tr("Button.Close") };
        Desktop desktop = null;
        if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();
            if (desktop.isSupported(Desktop.Action.BROWSE)) {
                options = new Object[] { tr("Button.Close"), tr("Button.Website") };
            }
        }
        StringBuffer message = new StringBuffer();
        message.append("<html><b><font color='red' size='5'>").append(tr("Application.title"));
        message.append("</font></b><br>").append(tr("Application.description"));
        message.append("<br>Copyright  2005-2014 The Xtreme Media Player Project");
        message.append("<br><br><b>").append(tr("Dialog.About.Authors")).append(": </b>")
                .append(tr("Application.authors"));
        message.append("<br><b>").append(tr("Dialog.About.Version")).append(": </b>").append(currentVersion);
        message.append("<br><b>").append(tr("Dialog.About.Codename")).append(": </b>")
                .append(currentVersion.getCodename());
        message.append("<br><b>").append(tr("Dialog.About.ReleaseDate")).append(": </b>")
                .append(currentVersion.getReleaseDate());
        message.append("<br><b>").append(tr("Dialog.About.Homepage")).append(": </b>")
                .append(tr("Application.homepage"));
        message.append("<br><br><b>").append(tr("Dialog.About.JavaVersion")).append(": </b>")
                .append(System.getProperty("java.version"));
        message.append("<br><b>").append(tr("Dialog.About.JavaVendor")).append(": </b>")
                .append(System.getProperty("java.vendor"));
        message.append("<br><b>").append(tr("Dialog.About.JavaHome")).append(": </b>")
                .append(System.getProperty("java.home"));
        message.append("<br><b>").append(tr("Dialog.About.OSName")).append(": </b>")
                .append(System.getProperty("os.name"));
        message.append("<br><b>").append(tr("Dialog.About.OSArch")).append(": </b>")
                .append(System.getProperty("os.arch"));
        message.append("<br><b>").append(tr("Dialog.About.UserName")).append(": </b>")
                .append(System.getProperty("user.name"));
        message.append("<br><b>").append(tr("Dialog.About.UserHome")).append(": </b>")
                .append(System.getProperty("user.home"));
        message.append("<br><b>").append(tr("Dialog.About.UserDir")).append(": </b>")
                .append(System.getProperty("user.dir"));
        message.append("</html>");
        int n = JOptionPane.showOptionDialog(mainFrame, message, tr("Dialog.About"),
                JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, Utilities.APP_256_ICON, options,
                options[0]);
        if (n == 1 && desktop != null) {
            try {
                URL url = new URL(tr("Application.homepage"));
                desktop.browse(url.toURI());
            } catch (IOException | URISyntaxException ex) {
                logger.error(ex.getMessage(), ex);
            }
        }
    } else if (source.equals(playModeRepeatNoneMenuItem)) {
        playlist.setPlayMode(Playlist.PlayMode.REPEAT_NONE);
    } else if (source.equals(playModeRepeatOneMenuItem)) {
        playlist.setPlayMode(Playlist.PlayMode.REPEAT_ONE);
    } else if (source.equals(playModeRepeatAllMenuItem)) {
        playlist.setPlayMode(Playlist.PlayMode.REPEAT_ALL);
    } else if (source.equals(playModeShuffleMenuItem)) {
        playlist.setPlayMode(Playlist.PlayMode.SHUFFLE);
    }
}

From source file:zxmax.tools.timerreview.gui.StartTimerWindow.java

private void storeDataAndStartTimer() {

    // prepare data to store
    Tomato tomato = new Tomato(taFocusOn.getText());
    tomato.setTitle(tfTitle.getText());//from  w  ww .  j  a  v  a 2 s  . co m

    try {
        tomato.setDuration(Integer.parseInt(txtDurata.getText()));
    } catch (NumberFormatException ex) {
        tomato.setDuration(1);
    }

    List<String> errorMessages = validatorService.validate(tomato);
    int response = 0;
    if (errorMessages.size() > 0) {
        String message = StringUtils.join(errorMessages, System.getProperty("line.separator"));
        response = JOptionPane.showOptionDialog(null, message,
                I18N.getLabel(this.getClass(), "error.box.title"), JOptionPane.DEFAULT_OPTION,
                JOptionPane.PLAIN_MESSAGE, null, new Object[] {}, null);
    }

    if (response > -1) {

        getBasicDao().save(tomato);
        logger.debug(tomato.toString());

        StringBuilder sb = new StringBuilder();
        // sb.append((new LocalDateTime()).toString("dd/MM/yyyy HH:mm"))
        // .append(System.getProperty("line.separator"));

        sb.append(OrgModeDecorator.ORG_MODE_LEVEL_1 + I18N.getLabel(this.getClass(), TIMER_LOGGER_TITOLO))

                .append(tomato.getTitle()).append(System.getProperty("line.separator"));
        sb.append(OrgModeDecorator.ORG_MODE_LEVEL_2 + I18N.getLabel(this.getClass(), TIMER_LOGGER_FOCUS_ON))
                .append(tomato.getFocusOn());

        reportLogger.info(sb.toString());

        disableNewTimerMenuItem();

        startCountdown(tomato);

        UINotificationService uiNotificationService = new UINotificationService(tomato);
        Register.put(UINotificationService.class, uiNotificationService);

        closeThisWindow();
    }
}

From source file:zxmax.tools.timerreview.Main.java

public static void main(final String[] args) {
    try {/*w w w .  ja v  a2  s  .  c o  m*/

        JustOneLock ua = new JustOneLock(".timerreview");
        if (ua.isAppActive()) {
            String message = I18N.getLabel(MyUncaughtExceptionHandler.class, "another.instance.already.open");

            JOptionPane.showOptionDialog(null, message,
                    I18N.getLabel(MyUncaughtExceptionHandler.class, "error.box.title"),
                    JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[] {}, null);

            System.exit(0);
        }
        new Main();
    } catch (Exception e) {

        if (e instanceof IllegalStateException) {
            JOptionPane.showMessageDialog(null,
                    "controlla i file di log e contatta, se ti va, lo sviluppatore, ciao.");
        }
        LOGGER.error("", e);
    }
}