Example usage for javax.swing JOptionPane OK_OPTION

List of usage examples for javax.swing JOptionPane OK_OPTION

Introduction

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

Prototype

int OK_OPTION

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

Click Source Link

Document

Return value form class method if OK is chosen.

Usage

From source file:com.floreantpos.ui.dialog.ManagerDialog.java

private void doShowServerTips(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnResetDrawerActionPerformed
    try {//  w  w  w.j a  v a2s  .c om
        setGlassPaneVisible(true);

        JPanel panel = new JPanel(new MigLayout());
        List<User> users = UserDAO.getInstance().findAll();

        JXDatePicker fromDatePicker = UiUtil.getCurrentMonthStart();
        JXDatePicker toDatePicker = UiUtil.getCurrentMonthEnd();

        panel.add(new JLabel(com.floreantpos.POSConstants.SELECT_USER + ":"), "grow"); //$NON-NLS-1$ //$NON-NLS-2$
        JComboBox userCombo = new JComboBox(new ListComboBoxModel(users));
        panel.add(userCombo, "grow, wrap"); //$NON-NLS-1$
        panel.add(new JLabel(com.floreantpos.POSConstants.FROM + ":"), "grow"); //$NON-NLS-1$ //$NON-NLS-2$
        panel.add(fromDatePicker, "wrap"); //$NON-NLS-1$
        panel.add(new JLabel(com.floreantpos.POSConstants.TO_), "grow"); //$NON-NLS-1$
        panel.add(toDatePicker);

        int option = JOptionPane.showOptionDialog(ManagerDialog.this, panel,
                com.floreantpos.POSConstants.SELECT_CRIETERIA, JOptionPane.OK_CANCEL_OPTION,
                JOptionPane.QUESTION_MESSAGE, null, null, null);
        if (option != JOptionPane.OK_OPTION) {
            return;
        }

        GratuityDAO gratuityDAO = new GratuityDAO();
        TipsCashoutReport report = gratuityDAO.createReport(fromDatePicker.getDate(), toDatePicker.getDate(),
                (User) userCombo.getSelectedItem());

        TipsCashoutReportDialog dialog = new TipsCashoutReportDialog(report);
        dialog.setSize(400, 600);
        dialog.open();
    } catch (Exception e) {
        POSMessageDialog.showError(Application.getPosWindow(), com.floreantpos.POSConstants.ERROR_MESSAGE, e);
    } finally {
        setGlassPaneVisible(false);
    }
}

From source file:com.microsoftopentechnologies.intellij.helpers.AndroidStudioHelper.java

public static void deleteActivityTemplates(Object caller) throws IOException, InterruptedException {
    String[] cmd = null;//from   ww  w. ja va  2  s.c  om

    String templatePath = URLDecoder
            .decode(ApplicationComponent.class.getResource("").getPath().replace("file:/", ""), "UTF-8");
    templatePath = templatePath.replace("/", File.separator);
    templatePath = templatePath.substring(0, templatePath.indexOf(File.separator + "lib"));
    templatePath = templatePath + File.separator + "plugins" + File.separator + "android" + File.separator;
    templatePath = templatePath + "lib" + File.separator + "templates" + File.separator + "activities"
            + File.separator;

    String[] env = null;

    String tmpdir = getTempLocation();
    BufferedInputStream bufferedInputStream = new BufferedInputStream(
            ServiceCodeReferenceHelper.getTemplateResource("ActivityTemplate.zip"));
    unZip(bufferedInputStream, tmpdir);

    if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
        try {
            VirtualFile mobileTemplate = LocalFileSystem.getInstance()
                    .findFileByIoFile(new File(templatePath + mobileServicesTemplateName));
            VirtualFile officeTemplate = LocalFileSystem.getInstance()
                    .findFileByIoFile(new File(templatePath + officeTemplateName));

            if (mobileTemplate != null)
                mobileTemplate.delete(caller);

            if (officeTemplate != null)
                officeTemplate.delete(caller);
        } catch (IOException ex) {
            PrintWriter printWriter = new PrintWriter(tmpdir + "\\script.bat");
            printWriter.println("@echo off");
            printWriter.println("del \"" + templatePath + mobileServicesTemplateName + "\" /Q /S");
            printWriter.println("del \"" + templatePath + officeTemplateName + "\" /Q /S");
            printWriter.flush();
            printWriter.close();

            String[] tmpcmd = { tmpdir + "\\elevate.exe", "script.bat", "1" };

            cmd = tmpcmd;

            ArrayList<String> tempenvlist = new ArrayList<String>();
            for (String envval : System.getenv().keySet())
                tempenvlist.add(String.format("%s=%s", envval, System.getenv().get(envval)));

            tempenvlist.add("PRECOMPILE_STREAMLINE_FILES=1");
            env = new String[tempenvlist.size()];
            tempenvlist.toArray(env);

            Runtime rt = Runtime.getRuntime();
            Process proc = rt.exec(cmd, env, new File(tmpdir));
            proc.waitFor();
        }
    } else if (System.getProperty("os.name").toLowerCase().startsWith("mac")) {
        VirtualFile mobileTemplate = LocalFileSystem.getInstance()
                .findFileByIoFile(new File(templatePath + mobileServicesTemplateName));
        VirtualFile officeTemplate = LocalFileSystem.getInstance()
                .findFileByIoFile(new File(templatePath + officeTemplateName));

        if (mobileTemplate != null && officeTemplate != null) {
            exec(new String[] { "osascript", "-e",
                    "do shell script \"rm -r \\\"/" + templatePath + mobileServicesTemplateName + "\\\"\"",
                    "-e", "do shell script \"rm -r \\\"/" + templatePath + officeTemplateName + "\\\"\"" },
                    tmpdir);
        }
    } else {
        try {
            VirtualFile mobileTemplate = LocalFileSystem.getInstance()
                    .findFileByIoFile(new File(templatePath + mobileServicesTemplateName));
            VirtualFile officeTemplate = LocalFileSystem.getInstance()
                    .findFileByIoFile(new File(templatePath + officeTemplateName));

            mobileTemplate.delete(caller);
            officeTemplate.delete(caller);
        } catch (IOException ex) {

            JPasswordField pf = new JPasswordField();
            int okCxl = JOptionPane.showConfirmDialog(null, pf,
                    "To copy Microsoft Services templates, the plugin needs your password:",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);

            if (okCxl == JOptionPane.OK_OPTION) {
                String password = new String(pf.getPassword());

                exec(new String[] { "echo", password, "|", "sudo", "-S", "rm", "-r",
                        tmpdir + mobileServicesTemplateName, templatePath + mobileServicesTemplateName },
                        tmpdir);

                exec(new String[] { "echo", password, "|", "sudo", "-S", "rm", "-r",
                        tmpdir + officeTemplateName, templatePath + officeTemplateName }, tmpdir);
            }
        }
    }
}

From source file:sim.util.media.chart.ChartGenerator.java

/** Stops a Quicktime movie and cleans up, flushing the remaining frames out to disk. 
This method ought to be called from the main event loop. */
public void stopMovie() {
    if (movieMaker == null)
        return; // already stopped
    if (!movieMaker.stop()) {
        Object[] options = { "Drat" };
        JOptionPane.showOptionDialog(this,
                "Your movie did not write to disk\ndue to a spurious JMF movie generation bug.",
                "JMF Movie Generation Bug", JOptionPane.OK_OPTION, JOptionPane.WARNING_MESSAGE, null, options,
                options[0]);//from   w  w w .j ava  2 s .  c o  m
    }
    movieMaker = null;
    if (movieButton != null) // hasn't been destroyed yet
    {
        movieButton.setText("Create Movie");
    }
}

From source file:edu.harvard.mcz.imagecapture.RunnableJobReportDialog.java

protected void serializeTableModel() {
    PrintWriter out = null;//from   ww  w .j  a v a  2  s.co m
    CSVPrinter writer = null;
    try {
        int cols = jTable.getModel().getColumnCount();
        CSVFormat csvFormat = CSVFormat.DEFAULT.withQuoteMode(QuoteMode.ALL)
                .withHeaderComments(jTextArea.getText());
        TableModel model = jTable.getModel();
        switch (cols) {
        case 9:
            csvFormat = CSVFormat.DEFAULT.withQuoteMode(QuoteMode.ALL)
                    .withHeader(model.getColumnName(0), model.getColumnName(1), model.getColumnName(2),
                            model.getColumnName(3), model.getColumnName(4), model.getColumnName(5),
                            model.getColumnName(6), model.getColumnName(7), model.getColumnName(8))
                    .withCommentMarker('*').withHeaderComments(jTextArea.getText());
            break;
        case 6:
            csvFormat = CSVFormat.DEFAULT.withQuoteMode(QuoteMode.ALL)
                    .withHeader(model.getColumnName(0), model.getColumnName(1), model.getColumnName(2),
                            model.getColumnName(3), model.getColumnName(4), model.getColumnName(5))
                    .withCommentMarker('*').withHeaderComments(jTextArea.getText());
            break;
        case 5:
            csvFormat = CSVFormat.DEFAULT.withQuoteMode(QuoteMode.ALL)
                    .withHeader(model.getColumnName(0), model.getColumnName(1), model.getColumnName(2),
                            model.getColumnName(3), model.getColumnName(4))
                    .withCommentMarker('*').withHeaderComments(jTextArea.getText());
            break;
        case 4:
            csvFormat = CSVFormat.DEFAULT.withQuoteMode(QuoteMode.ALL)
                    .withHeader(model.getColumnName(0), model.getColumnName(1), model.getColumnName(2),
                            model.getColumnName(3))
                    .withCommentMarker('*').withHeaderComments(jTextArea.getText());
            break;
        }

        log.debug(jTextArea.getText());
        log.debug(csvFormat.getHeaderComments());

        Date now = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyymmdd_HHmmss");
        String time = dateFormat.format(now);
        String filename = "jobreport_" + time + ".csv";
        out = new PrintWriter(filename);

        writer = new CSVPrinter(out, csvFormat);
        writer.flush();

        int rows = jTable.getModel().getRowCount();
        for (int i = 0; i < rows; i++) {
            ArrayList<String> values = new ArrayList<String>();
            for (int col = 0; col < cols; col++) {
                values.add((String) jTable.getModel().getValueAt(i, col));
            }

            writer.printRecord(values);
        }
        writer.flush();
        writer.close();
        JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(),
                "Saved report to file: " + filename, "Report to CSV file", JOptionPane.OK_OPTION);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } finally {
        try {
            out.close();
        } catch (Exception e) {
        }
        try {
            writer.close();
        } catch (Exception e) {
        }

    }
}

From source file:calendarexportplugin.exporter.GoogleExporter.java

/**
 * Show the Login-Dialog/*  w  ww . jav  a  2s. c  o  m*/
 *
 * @param settings
 *          Settings to use for this Dialog
 * @return true, if successful
 */
private boolean showLoginDialog(CalendarExportSettings settings) {
    LoginDialog login;

    Window parent = CalendarExportPlugin.getInstance().getBestParentFrame();

    login = new LoginDialog(parent, settings.getExporterProperty(USERNAME),
            IOUtilities.xorDecode(settings.getExporterProperty(PASSWORD), 345903),
            settings.getExporterProperty(STORE_PASSWORD, false));

    if (login.askLogin() != JOptionPane.OK_OPTION) {
        return false;
    }

    if ((StringUtils.isBlank(login.getUsername()) || (StringUtils.isBlank(login.getPassword())))) {
        JOptionPane.showMessageDialog(parent,
                mLocalizer.msg("noUserOrPassword", "No Username or Password entered!"),
                Localizer.getLocalization(Localizer.I18N_ERROR), JOptionPane.ERROR_MESSAGE);
        return false;
    }

    settings.setExporterProperty(USERNAME, login.getUsername().trim());

    if (login.storePasswords()) {
        settings.setExporterProperty(PASSWORD, IOUtilities.xorEncode(login.getPassword().trim(), 345903));
        settings.setExporterProperty(STORE_PASSWORD, true);
    } else {
        settings.setExporterProperty(PASSWORD, "");
        settings.setExporterProperty(STORE_PASSWORD, false);
    }

    mPassword = login.getPassword().trim();
    return true;
}

From source file:edu.gmu.cs.sim.util.media.chart.ChartGenerator.java

/** Stops a Quicktime movie and cleans up, flushing the remaining frames out to disk.
 This method ought to be called from the main event loop. */
public void stopMovie() {
    if (movieMaker == null) {
        return; // already stopped
    }/*  w  w w . j ava  2 s  .co  m*/
    if (!movieMaker.stop()) {
        Object[] options = { "Drat" };
        JOptionPane.showOptionDialog(this,
                "Your movie did not write to disk\ndue to a spurious JMF movie generation bug.",
                "JMF Movie Generation Bug", JOptionPane.OK_OPTION, JOptionPane.WARNING_MESSAGE, null, options,
                options[0]);
    }
    movieMaker = null;
    if (movieButton != null) // hasn't been destroyed yet
    {
        movieButton.setText("Create Movie");
    }
}

From source file:gui.DownloadManagerGUI.java

public DownloadManagerGUI(String name) {
    super(name);//from  ww w  .  j av a  2  s  .com

    setLayout(new BorderLayout());

    preferences = Preferences.userRoot().node("db");
    final PreferencesDTO preferencesDTO = getPreferences();

    LookAndFeel.setLaf(preferencesDTO.getPreferencesInterfaceDTO().getLookAndFeelName());

    createFileHierarchy();

    mainToolbar = new MainToolBar();
    categoryPanel = new CategoryPanel(
            preferencesDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs());
    downloadPanel = new DownloadPanel(this, preferencesDTO.getPreferencesSaveDTO().getDatabasePath(),
            preferencesDTO.getPreferencesConnectionDTO().getConnectionTimeOut(),
            preferencesDTO.getPreferencesConnectionDTO().getReadTimeOut());
    messagePanel = new MessagePanel(this);
    JTabbedPane mainTabPane = new JTabbedPane();
    mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, categoryPanel, mainTabPane);
    mainSplitPane.setOneTouchExpandable(true);
    statusPanel = new StatusPanel();
    addNewDownloadDialog = new AddNewDownloadDialog(this);

    mainTabPane.addTab(messagesBundle.getString("downloadManagerGUI.mainTabPane.downloadPanel"), downloadPanel);
    mainTabPane.addTab(messagesBundle.getString("downloadManagerGUI.mainTabPane.messagePanel"), messagePanel);

    preferenceDialog = new PreferenceDialog(this, preferencesDTO);

    aboutDialog = new AboutDialog(this);

    categoryPanel.setCategoryPanelListener((fileExtensions, downloadCategory) -> downloadPanel
            .setDownloadsByDownloadPath(fileExtensions, downloadCategory));

    //     preferenceDialog.setDefaults(preferencesDTO);

    addNewDownloadDialog.setAddNewDownloadListener(textUrl -> {
        Objects.requireNonNull(textUrl, "textUrl");
        if (textUrl.equals(""))
            throw new IllegalArgumentException("textUrl is empty");

        String downloadName;
        try {
            downloadName = ConnectionUtil.getRealFileName(textUrl);
        } catch (IOException e) {
            logger.error("Can't get real name of file that you want to download." + textUrl);
            messageLogger.error("Can't get real name of file that you want to download." + textUrl);
            downloadName = ConnectionUtil.getFileName(textUrl);
        }
        String fileExtension = FilenameUtils.getExtension(downloadName);
        File downloadPathFile = new File(
                preferencesDTO.getPreferencesSaveDTO().getPathByFileExtension(fileExtension));
        File downloadRangeFile = new File(preferencesDTO.getPreferencesSaveDTO().getTempDirectory());
        int maxNum = preferencesDTO.getPreferencesConnectionDTO().getMaxConnectionNumber();

        Download download = null;

        List<Download> downloads = downloadPanel.getDownloadList();
        String properDownloadName = getProperNameForDownload(downloadName, downloads, downloadPathFile);

        // todo must set stretegy pattern
        switch (ProtocolType.valueOfByDesc(textUrl.getProtocol())) {
        case HTTP:
            download = new HttpDownload(downloadPanel.getNextDownloadID(), textUrl, properDownloadName, maxNum,
                    downloadPathFile, downloadRangeFile, ProtocolType.HTTP);
            break;
        case FTP:
            // todo must be created ...
            break;
        case HTTPS:
            download = new HttpsDownload(downloadPanel.getNextDownloadID(), textUrl, properDownloadName, maxNum,
                    downloadPathFile, downloadRangeFile, ProtocolType.HTTPS);
            break;
        }

        downloadPanel.addDownload(download);
    });

    // Add panels to display.
    add(mainToolbar, BorderLayout.PAGE_START);
    add(mainSplitPane, BorderLayout.CENTER);
    add(statusPanel, BorderLayout.PAGE_END);

    setJMenuBar(initMenuBar());

    mainToolbar.setMainToolbarListener(new MainToolbarListener() {
        @Override
        public void newDownloadEventOccured() {
            addNewDownloadDialog.setVisible(true);
            addNewDownloadDialog.onPaste();
        }

        @Override
        public void pauseEventOccured() {
            downloadPanel.actionPause();
            mainToolbar.setStateOfButtonsControl(false, false, false, false, false, true); // canceled
        }

        @Override
        public void resumeEventOccured() {
            downloadPanel.actionResume();
        }

        @Override
        public void pauseAllEventOccured() {
            downloadPanel.actionPauseAll();
        }

        @Override
        public void clearEventOccured() {
            downloadPanel.actionClear();
        }

        @Override
        public void clearAllCompletedEventOccured() {
            downloadPanel.actionClearAllCompleted();
        }

        @Override
        public void reJoinEventOccured() {
            downloadPanel.actionReJoinFileParts();
        }

        @Override
        public void reDownloadEventOccured() {
            downloadPanel.actionReDownload();
        }

        @Override
        public void propertiesEventOccured() {
            downloadPanel.actionProperties();
        }

        @Override
        public void preferencesEventOccured() {
            preferenceDialog.setVisible(true);
        }
    });

    downloadPanel.setDownloadPanelListener(new DownloadPanelListener() {
        @Override
        public void stateChangedEventOccured(DownloadStatus downloadState) {
            updateButtons(downloadState);
        }

        @Override
        public void downloadSelected(Download download) {
            statusPanel.setStatus(download.getDownloadName());
        }
    });

    preferenceDialog.setPreferencesListener(new PreferencesListener() {
        @Override
        public void preferencesSet(PreferencesDTO preferenceDTO) {
            setPreferencesOS(preferenceDTO);
        }

        @Override
        public void preferenceReset() {
            PreferencesDTO resetPreferencesDTO = getPreferences();
            preferenceDialog.setPreferencesDTO(resetPreferencesDTO);
            categoryPanel.setTreeModel(
                    resetPreferencesDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs());
        }

        @Override
        public void preferenceDefaults() {
            PreferencesDTO defaultPreferenceDTO = new PreferencesDTO();
            resetAndSetPreferencesDTOFromConf(defaultPreferenceDTO);
            preferenceDialog.setPreferencesDTO(defaultPreferenceDTO);
            categoryPanel.setTreeModel(
                    defaultPreferenceDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs());
        }
    });

    // Handle window closing events.
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent windowEvent) {
            int action = JOptionPane.showConfirmDialog(DownloadManagerGUI.this,
                    "Do you realy want to exit the application?", "Confirm Exit", JOptionPane.OK_CANCEL_OPTION);
            if (action == JOptionPane.OK_OPTION) {
                logger.info("Window Closing");
                downloadPanel.actionPauseAll();
                dispose();
                System.gc();
            }
        }
    });

    Authenticator.setDefault(new DialogAuthenticator(this));

    setIconImage(
            Utils.createIcon(messagesBundle.getString("downloadManagerGUI.mainFrame.iconPath")).getImage());

    setMinimumSize(new Dimension(640, 480));
    // Set window size.
    pack();
    setSize(900, 580);

    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    setVisible(true);
}

From source file:com.paniclauncher.data.Instance.java

public void launch() {
    final Account account = App.settings.getAccount();
    if (account == null) {
        String[] options = { App.settings.getLocalizedString("common.ok") };
        JOptionPane.showOptionDialog(App.settings.getParent(),
                App.settings.getLocalizedString("instance.noaccount"),
                App.settings.getLocalizedString("instance.noaccountselected"), JOptionPane.DEFAULT_OPTION,
                JOptionPane.ERROR_MESSAGE, null, options, options[0]);
        App.settings.setMinecraftLaunched(false);
    } else {/*from www  .j a  v  a  2  s.c om*/
        String username = account.getUsername();
        String password = account.getPassword();
        if (!account.isRemembered()) {
            JPanel panel = new JPanel();
            panel.setLayout(new BorderLayout());
            JLabel passwordLabel = new JLabel(
                    App.settings.getLocalizedString("instance.enterpassword", account.getMinecraftUsername()));
            JPasswordField passwordField = new JPasswordField();
            panel.add(passwordLabel, BorderLayout.NORTH);
            panel.add(passwordField, BorderLayout.CENTER);
            int ret = JOptionPane.showConfirmDialog(App.settings.getParent(), panel,
                    App.settings.getLocalizedString("instance.enterpasswordtitle"),
                    JOptionPane.OK_CANCEL_OPTION);
            if (ret == JOptionPane.OK_OPTION) {
                password = new String(passwordField.getPassword());
            } else {
                App.settings.setMinecraftLaunched(false);
                return;
            }
        }
        boolean loggedIn = false;
        String url = null;
        String sess = null;
        String auth = null;
        if (!App.settings.isInOfflineMode()) {
            if (isNewLaunchMethod()) {
                String result = Utils.newLogin(username, password);
                if (result == null) {
                    loggedIn = true;
                    sess = "token:0:0";
                } else {
                    JSONParser parser = new JSONParser();
                    try {
                        Object obj = parser.parse(result);
                        JSONObject jsonObject = (JSONObject) obj;
                        if (jsonObject.containsKey("accessToken")) {
                            String accessToken = (String) jsonObject.get("accessToken");
                            JSONObject profile = (JSONObject) jsonObject.get("selectedProfile");
                            String profileID = (String) profile.get("id");
                            sess = "token:" + accessToken + ":" + profileID;
                            loggedIn = true;
                        } else {
                            auth = (String) jsonObject.get("errorMessage");
                        }
                    } catch (ParseException e1) {
                        App.settings.getConsole().logStackTrace(e1);
                    }
                }
            } else {
                try {
                    url = "https://login.minecraft.net/?user=" + URLEncoder.encode(username, "UTF-8")
                            + "&password=" + URLEncoder.encode(password, "UTF-8") + "&version=999";
                } catch (UnsupportedEncodingException e1) {
                    App.settings.getConsole().logStackTrace(e1);
                }
                auth = Utils.urlToString(url);
                if (auth == null) {
                    loggedIn = true;
                    sess = "0";
                } else {
                    if (auth.contains(":")) {
                        String[] parts = auth.split(":");
                        if (parts.length == 5) {
                            loggedIn = true;
                            sess = parts[3];
                        }
                    }
                }
            }
        } else {
            loggedIn = true;
            sess = "token:0:0";
        }
        if (!loggedIn) {
            String[] options = { App.settings.getLocalizedString("common.ok") };
            JOptionPane
                    .showOptionDialog(App.settings.getParent(),
                            "<html><center>" + App.settings.getLocalizedString("instance.errorloggingin",
                                    "<br/><br/>" + auth) + "</center></html>",
                            App.settings.getLocalizedString("instance.errorloggingintitle"),
                            JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]);
            App.settings.setMinecraftLaunched(false);
        } else {
            final String session = sess;
            Thread launcher = new Thread() {
                public void run() {
                    try {
                        long start = System.currentTimeMillis();
                        if (App.settings.getParent() != null) {
                            App.settings.getParent().setVisible(false);
                        }
                        Process process = null;
                        if (isNewLaunchMethod()) {
                            process = NewMCLauncher.launch(account, Instance.this, session);
                        } else {
                            process = MCLauncher.launch(account, Instance.this, session);
                        }
                        App.settings.showKillMinecraft(process);
                        InputStream is = process.getInputStream();
                        InputStreamReader isr = new InputStreamReader(is);
                        BufferedReader br = new BufferedReader(isr);
                        String line;
                        while ((line = br.readLine()) != null) {
                            App.settings.getConsole().logMinecraft(line);
                        }
                        App.settings.hideKillMinecraft();
                        if (App.settings.getParent() != null) {
                            App.settings.getParent().setVisible(true);
                        }
                        long end = System.currentTimeMillis();
                        if (App.settings.isInOfflineMode()) {
                            App.settings.checkOnlineStatus();
                        }
                        App.settings.setMinecraftLaunched(false);
                        if (!App.settings.isInOfflineMode()) {
                            if (App.settings.isUpdatedFiles()) {
                                App.settings.reloadLauncherData();
                            }
                        }
                    } catch (IOException e1) {
                        App.settings.getConsole().logStackTrace(e1);
                    }
                }
            };
            launcher.start();
        }
    }
}

From source file:edu.virginia.speclab.juxta.author.view.export.WebServiceExportDialog.java

private void viewWebServiceData() {
    String urlStr = this.wsClient.getBaseUrl();
    urlStr += "/sets/" + this.exportTaskId + "/view?mode=heatmap";
    try {/*from   w ww  . j  a v  a 2s . co m*/
        URI uri = new URI(urlStr);
        java.awt.Desktop.getDesktop().browse(uri);
    } catch (Exception e) {
        String msg = "Unable to view comparison set. You can verify the export by\n"
                + "opening a browser and going to :\n\n" + urlStr;
        JOptionPane.showMessageDialog(this.juxtaFrame, msg, "Error", JOptionPane.OK_OPTION);
    }
}

From source file:kevin.gvmsgarch.App.java

private static String getPassword() {
    String retval = null;//from w  w w. j a  v a  2s .  c o m
    JPasswordField pwd = new JPasswordField(20);
    int optionSelected = JOptionPane.showConfirmDialog(null, pwd, "Enter Password",
            JOptionPane.OK_CANCEL_OPTION);
    if (optionSelected == JOptionPane.OK_OPTION) {
        retval = new String(pwd.getPassword());
    }
    return retval;
}