Example usage for javax.swing JOptionPane showInputDialog

List of usage examples for javax.swing JOptionPane showInputDialog

Introduction

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

Prototype

public static String showInputDialog(Component parentComponent, Object message, Object initialSelectionValue) 

Source Link

Document

Shows a question-message dialog requesting input from the user and parented to parentComponent.

Usage

From source file:uk.co.markfrimston.tasktree.Main.java

protected String prompt(String existing) {
    return JOptionPane.showInputDialog(this, "Enter label", existing);
}

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

public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd == "Salvar") {
        salvaAlteracoes.salvar();//from w  w w. ja  v  a  2  s  .com
        /*
         * if (arquivo == null) { salvarComo(); // avalia(); return; }
         * arquivo.write(boxCode.getText());//
         */
        // avalia();
        reavalia(textAreaSourceCode.getText());
    } else if (cmd == "Aplicar") {

        if (controle != null) {

            int pos = controle.getIniIndex(erroAtual);
            String newCod;
            newCod = controle.corrige(texto.getText(), erroAtual);
            textAreaSourceCode.setText(newCod);
            salvaAlteracoes.setAlterado();
            TxtBuffer.setContent(textAreaSourceCode.getText());
            reavalia(newCod);
            textAreaSourceCode.getTextPane().setCaretPosition(pos);
            controle.avalia(textAreaSourceCode.getText(), true);
        }
    } else if (cmd == "AbrirURL") {
        String url;
        url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://");
        avaliaUrl(url);
    } else if (cmd == "Abrir") {
        String a[] = { ".html", ".htm" };
        G_File temp = new G_File(caminhoRecente.read(), a);
        if (temp.getFile() != null) {
            avaliaArq(temp);
        }
    } else if (cmd == "SaveAs") {
        // salvarComo();
        salvaAlteracoes.salvarComo();
        // avalia();
    } else if (cmd == "Creditos") {
        new Creditos();
    } else if (cmd == "Sair") {
        System.exit(0);
    } else if (cmd == "SelecionarTudo") {
        textAreaSourceCode.getTextPane().selectAll();
    } else if (cmd == "Desfazer") {
        textAreaSourceCode.undo();
        // System.out.println("Undo");
        // boxCode.coloreSource();
        // reavalia(boxCode.getText());
    } else if (cmd == "AumentaFonte") {
        textAreaSourceCode.aumentaFontSize();
    } else if (cmd == "DiminuiFonte") {
        textAreaSourceCode.diminuiFontSize();
    } else if (cmd == "Contraste") {
        textAreaSourceCode.autoContraste();
        reavalia(textAreaSourceCode.getText());
    } else if (cmd == "Cancelar") {
        salvaAlteracoes.cancelar();
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.links_redundantes.PanelLinkRedundante.java

public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd == "Salvar") {
        salvaAlteracoes.salvar();//w ww . j av  a  2s  . c o m
        /*   if (arquivo == null) {
           salvarComo();
           // avalia();
           return;
        }
        arquivo.write(boxCode.getText());//*/
        //avalia();
        reavalia(textAreaSourceCode.getText());
    } else if (cmd == "Aplicar") {

        if (controle != null) {

            int pos = controle.getIniIndex(erroAtual);
            String newCod;
            try {
                newCod = controle.corrige(texto.getText(), erroAtual);
                textAreaSourceCode.setText(newCod);
                salvaAlteracoes.setAlterado();
                TxtBuffer.setContent(textAreaSourceCode.getText());
                reavalia(newCod);
                textAreaSourceCode.getTextPane().setCaretPosition(pos);
            } catch (ExceptionImagemNotFound e1) {
                JOptionPane.showMessageDialog(this, e1.getMessage());
            }
            controle.avalia(textAreaSourceCode.getText(), true);
        }
    } else if (cmd == "AbrirURL") {
        String url;
        url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://");
        avaliaUrl(url);
        // JOptionPane.showMessageDialog(null, "Seu nome  " + nome);

    } else if (cmd == "Abrir") {

        String a[] = { ".html", ".htm" };
        G_File temp = new G_File(caminhoRecente.read(), a);
        if (temp.getFile() != null) {
            avaliaArq(temp);

        }
    } else if (cmd == "SaveAs") {
        //salvarComo();
        salvaAlteracoes.salvarComo();
        // avalia();
    } else if (cmd == "Creditos") {
        new Creditos();
    } else if (cmd == "Sair") {
        System.exit(0);
    } else if (cmd == "Desfazer") {
        textAreaSourceCode.undo();
        //boxCode.coloreSource();
        //reavalia(boxCode.getText());
    } else if (cmd == "AumentaFonte") {
        textAreaSourceCode.aumentaFontSize();
    } else if (cmd == "DiminuiFonte") {
        textAreaSourceCode.diminuiFontSize();
    } else if (cmd == "Contraste") {
        textAreaSourceCode.autoContraste();
        reavalia(textAreaSourceCode.getText());
    } else if (cmd == "SelecionarTudo") {
        textAreaSourceCode.getTextPane().selectAll();
        if (painelOriginal != null) {
            painelOriginal.textAreaSourceCode.getTextPane().selectAll();
        }
    } else if (cmd == "Cancelar") {
        salvaAlteracoes.cancelar();
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.preenchedor_formulario.PanelPreenchedorFormulario.java

public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd == "Salvar") {
        salvaAlteracoes.salvar();/* w w  w.j a  v  a 2s  . c o m*/
        /*
         * if (arquivo == null) { salvarComo(); // avalia(); return; }
         * arquivo.write(boxCode.getText());//
         */
        avalia();
    } else if (cmd == "Aplicar") {

        if (controle != null) {

            int pos = controle.getIniIndex(erroAtual);
            String newCod = controle.corrige(texto.getText(), erroAtual);
            textAreaSourceCode.setText(newCod);
            salvaAlteracoes.setAlterado();
            TxtBuffer.setContent(textAreaSourceCode.getText());
            reavalia(newCod);
            codigo = textAreaSourceCode.getText();
            controle.avalia(codigo, true);
            textAreaSourceCode.getTextPane().setCaretPosition(pos);
            controle.avalia(this, codigo, true);
        }
    } else if (cmd == "AbrirURL") {
        String url;
        url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://");
        avaliaUrl(url);
    } else if (cmd == "Abrir") {

        String a[] = { ".html", ".htm" };
        G_File temp = new G_File(caminhoRecente.read(), a);
        if (temp.getFile() != null) {
            avaliaArq(temp);
        }
    } else if (cmd == "SaveAs") {
        // salvarComo();
        salvaAlteracoes.salvarComo();
        // avalia();
    } else if (cmd == "Creditos") {
        new Creditos();
    } else if (cmd == "Sair") {
        System.exit(0);
    } else if (cmd == "Desfazer") {
        textAreaSourceCode.undo();
        // boxCode.coloreSource();
        // reavalia(boxCode.getText());
    } else if (cmd == "AumentaFonte") {
        textAreaSourceCode.aumentaFontSize();
    } else if (cmd == "DiminuiFonte") {
        textAreaSourceCode.diminuiFontSize();
    } else if (cmd == "Contraste") {
        textAreaSourceCode.autoContraste();
        reavalia(textAreaSourceCode.getText());
    } else if (cmd == "SelecionarTudo") {
        textAreaSourceCode.getTextPane().selectAll();
        if (panelOriginal != null) {
            panelOriginal.textAreaSourceCode.getTextPane().selectAll();
        }
    } else if (cmd == "Cancelar") {
        salvaAlteracoes.cancelar();
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.label.PainelLabel.java

private void abreUrl() {
    String url;//from   w  w w.  ja va 2 s.  c om
    url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://");
    PegarPaginaWEB ppw = new PegarPaginaWEB();
    if (url != null) {
        try {
            String codHtml = ppw.getContent(url);
            TxtBuffer.setContentOriginal(codHtml, "0");
            parentFrame.showPainelFerramentaLabelPArq(codHtml);
            EstadoSilvinha.setLinkAtual(url);
        } 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:net.chaosserver.timelord.swingui.CommonTaskPanel.java

/**
 * Catch action events generated by the popup menu.
 *
 * @param evt the event//from   ww  w .j  a va2 s .  c  om
 */
public void actionPerformed(ActionEvent evt) {
    if (log.isTraceEnabled()) {
        log.trace("Got ActionEvent.getActionCommand [" + evt.getActionCommand() + "]");
    }

    if (CommonTaskPopupMenu.ACTION_ADDTASK.equals(evt.getActionCommand())) {
        showAddTaskDialog();
    } else if (CommonTaskPopupMenu.ACTION_ADDTIME.equals(evt.getActionCommand())) {
        showAddTimeDialog();
    } else if (CommonTaskPopupMenu.ACTION_DELTASK.equals(evt.getActionCommand())) {
        TaskDayPanel taskDayPanel = popupMenu.getTaskDayPanel();

        if (taskDayPanel != null) {
            TimelordTask timelordTask = taskDayPanel.getTimelordTask();

            int result = JOptionPane.showConfirmDialog(this,
                    "Delete [" + timelordTask.getTaskName() + "] Task?", "Delete Task",
                    JOptionPane.YES_NO_OPTION);

            if (result == 0) {
                getTimelordData().removeTask(timelordTask);
            }
        }
    } else if (CommonTaskPopupMenu.ACTION_RENTASK.equals(evt.getActionCommand())) {
        TaskDayPanel taskDayPanel = popupMenu.getTaskDayPanel();
        TimelordTask timelordTask = taskDayPanel.getTimelordTask();

        String newName = JOptionPane.showInputDialog(this, "Rename Task", timelordTask.getTaskName());

        if (newName != null) {
            if (taskDayPanel != null) {
                timelordTask.setTaskName(newName);
                getTimelordData().sortTaskCollection();
            }
        }
    } else if (CommonTaskPopupMenu.ACTION_EXPORT.equals(evt.getActionCommand())) {
        TaskDayPanel taskDayPanel = popupMenu.getTaskDayPanel();

        if (taskDayPanel != null) {
            TimelordTask timelordTask = taskDayPanel.getTimelordTask();
            timelordTask.setExportable(!timelordTask.isExportable());
        }
    } else if (CommonTaskPopupMenu.ACTION_HIDETASK.equals(evt.getActionCommand())) {
        TaskDayPanel taskDayPanel = popupMenu.getTaskDayPanel();

        if (taskDayPanel != null) {
            TimelordTask timelordTask = taskDayPanel.getTimelordTask();

            if (timelordTask.isHidden()) {
                timelordTask.setHidden(false);
            } else {
                timelordTask.setHidden(true);
            }
        }
    } else if (CommonTaskPopupMenu.ACTION_EDITNOTE.equals(evt.getActionCommand())) {
        TaskDayPanel taskDayPanel = popupMenu.getTaskDayPanel();

        if (taskDayPanel != null) {
            TimelordTask timelordTask = taskDayPanel.getTimelordTask();
            showEditNoteDialog(timelordTask);
        }
    } else if (ACTION_SEARCHTEXT.equals(evt.getActionCommand())) {
        if (log.isDebugEnabled()) {
            log.debug("Executing search with given input:" + searchTextField.getText());
            this.setTasknameFilter(searchTextField.getText());
        }
    }

}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.doctype.ferramentaDoctype.java

private void openUrl() {
    String url;
    url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://");
    avaliaUrl(url);
}

From source file:com.sciaps.view.SpectrometerStackPanel.java

public void getRegionTextFromUser() {

    String retval = JOptionPane.showInputDialog(Constants.MAIN_FRAME,
            "Enter region string (ex. Fe371.76-372.16,Co257.88-258.12):", "");

    if (retval != null && !retval.isEmpty()) {
        createRegionItem(retval);/*from ww  w  .  j  ava  2  s.c om*/
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.PanelDescricaoImagens.java

/**
 * Abre uma URL//  w ww  .  j av a  2s . c o m
 * 
 */
private void abreUrl() {
    String url;
    url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://");
    PegarPaginaWEB ppw = new PegarPaginaWEB();
    if (url != null) {
        try {
            String codHtml = ppw.getContent(url);
            TxtBuffer.setContentOriginal(codHtml, "0");
            parentFrame.showPainelFerramentaImgPArq(codHtml, url);
            EstadoSilvinha.setLinkAtual(url);
        } 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.navegacao_cego.PainelSimuladorNavegacao.java

private void openUrl() {
    String url;/*from  w  ww . j  a v  a  2s  . co m*/
    url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://www.acessobrasil.org.br");
    avaliaUrl(url);
}