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:DialogDemo.java

private JPanel createIconDialogBox() {
    JButton showItButton = null;/*from  w  w w. j  a v a 2 s . c om*/

    final int numButtons = 6;
    JRadioButton[] radioButtons = new JRadioButton[numButtons];
    final ButtonGroup group = new ButtonGroup();

    final String plainCommand = "plain";
    final String infoCommand = "info";
    final String questionCommand = "question";
    final String errorCommand = "error";
    final String warningCommand = "warning";
    final String customCommand = "custom";

    radioButtons[0] = new JRadioButton("Plain (no icon)");
    radioButtons[0].setActionCommand(plainCommand);

    radioButtons[1] = new JRadioButton("Information icon");
    radioButtons[1].setActionCommand(infoCommand);

    radioButtons[2] = new JRadioButton("Question icon");
    radioButtons[2].setActionCommand(questionCommand);

    radioButtons[3] = new JRadioButton("Error icon");
    radioButtons[3].setActionCommand(errorCommand);

    radioButtons[4] = new JRadioButton("Warning icon");
    radioButtons[4].setActionCommand(warningCommand);

    radioButtons[5] = new JRadioButton("Custom icon");
    radioButtons[5].setActionCommand(customCommand);

    for (int i = 0; i < numButtons; i++) {
        group.add(radioButtons[i]);
    }
    radioButtons[0].setSelected(true);

    showItButton = new JButton("Show it!");
    showItButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String command = group.getSelection().getActionCommand();

            // no icon
            if (command == plainCommand) {
                JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "A plain message",
                        JOptionPane.PLAIN_MESSAGE);
                // information icon
            } else if (command == infoCommand) {
                JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.",
                        "Inane informational dialog", JOptionPane.INFORMATION_MESSAGE);

                // XXX: It doesn't make sense to make a question with
                // XXX: only one button.
                // XXX: See "Yes/No (but not in those words)" for a better solution.
                // question icon
            } else if (command == questionCommand) {
                JOptionPane.showMessageDialog(frame,
                        "You shouldn't use a message dialog " + "(like this)\n" + "for a question, OK?",
                        "Inane question", JOptionPane.QUESTION_MESSAGE);
                // error icon
            } else if (command == errorCommand) {
                JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane error",
                        JOptionPane.ERROR_MESSAGE);
                // warning icon
            } else if (command == warningCommand) {
                JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane warning",
                        JOptionPane.WARNING_MESSAGE);
                // custom icon
            } else if (command == customCommand) {
                JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.", "Inane custom dialog",
                        JOptionPane.INFORMATION_MESSAGE, icon);
            }
        }
    });

    return create2ColPane(iconDesc + ":", radioButtons, showItButton);
}

From source file:com.sshtools.common.ui.SshToolsApplication.java

/**
 * Show an 'About' dialog//from  w  w  w  .j  av a  2s  .c o  m
 *
 *
 */
public void showAbout(final Component parent) {

    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);

    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel v = new MultilineLabel(getApplicationName() + " " + getApplicationVersion());
    v.setFont(v.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel x = new MultilineLabel(getAboutAuthors());
    x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    x.setFont(x.getFont().deriveFont(12f));
    UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER);

    MultilineLabel c = new MultilineLabel(getAboutLicenseDetails());
    c.setFont(c.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER);

    final JLabel h = new JLabel(getAboutURL());
    h.setForeground(Color.blue);
    h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10));
    h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    h.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent evt) {
            try {
                BrowserLauncher.openURL(getAboutURL());
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        }
    });
    UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER);

    JOptionPane.showMessageDialog(parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon());
}

From source file:net.pms.encoders.MEncoderVideo.java

@Override
public JComponent config() {
    // Apply the orientation for the locale
    Locale locale = new Locale(configuration.getLanguage());
    ComponentOrientation orientation = ComponentOrientation.getOrientation(locale);
    String colSpec = FormLayoutUtil.getColSpec(COL_SPEC, orientation);

    FormLayout layout = new FormLayout(colSpec, ROW_SPEC);
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);
    builder.setOpaque(false);/*from   w  w w  .  jav  a 2  s  . co m*/

    CellConstraints cc = new CellConstraints();

    checkBox = new JCheckBox(Messages.getString("MEncoderVideo.0"));
    checkBox.setContentAreaFilled(false);

    if (configuration.getSkipLoopFilterEnabled()) {
        checkBox.setSelected(true);
    }

    checkBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setSkipLoopFilterEnabled((e.getStateChange() == ItemEvent.SELECTED));
        }
    });

    JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"),
            FormLayoutUtil.flip(cc.xyw(1, 1, 15), colSpec, orientation));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    mencodermt = new JCheckBox(Messages.getString("MEncoderVideo.35"));
    mencodermt.setContentAreaFilled(false);

    if (configuration.getMencoderMT()) {
        mencodermt.setSelected(true);
    }

    mencodermt.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            configuration.setMencoderMT(mencodermt.isSelected());
        }
    });

    mencodermt.setEnabled(Platform.isWindows() || Platform.isMac());

    builder.add(mencodermt, FormLayoutUtil.flip(cc.xy(1, 3), colSpec, orientation));
    builder.add(checkBox, FormLayoutUtil.flip(cc.xyw(3, 3, 12), colSpec, orientation));

    noskip = new JCheckBox(Messages.getString("MEncoderVideo.2"));
    noskip.setContentAreaFilled(false);

    if (configuration.isMencoderNoOutOfSync()) {
        noskip.setSelected(true);
    }

    noskip.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderNoOutOfSync((e.getStateChange() == ItemEvent.SELECTED));
        }
    });

    builder.add(noskip, FormLayoutUtil.flip(cc.xy(1, 5), colSpec, orientation));

    JButton button = new JButton(Messages.getString("MEncoderVideo.29"));
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JPanel codecPanel = new JPanel(new BorderLayout());
            final JTextArea textArea = new JTextArea();
            textArea.setText(configuration.getMencoderCodecSpecificConfig());
            textArea.setFont(new Font("Courier", Font.PLAIN, 12));
            JScrollPane scrollPane = new JScrollPane(textArea);
            scrollPane.setPreferredSize(new java.awt.Dimension(900, 100));

            final JTextArea textAreaDefault = new JTextArea();
            textAreaDefault.setText(DEFAULT_CODEC_CONF_SCRIPT);
            textAreaDefault.setBackground(Color.WHITE);
            textAreaDefault.setFont(new Font("Courier", Font.PLAIN, 12));
            textAreaDefault.setEditable(false);
            textAreaDefault.setEnabled(configuration.isMencoderIntelligentSync());
            JScrollPane scrollPaneDefault = new JScrollPane(textAreaDefault);
            scrollPaneDefault.setPreferredSize(new java.awt.Dimension(900, 450));

            JPanel customPanel = new JPanel(new BorderLayout());
            intelligentsync = new JCheckBox(Messages.getString("MEncoderVideo.3"));
            intelligentsync.setContentAreaFilled(false);

            if (configuration.isMencoderIntelligentSync()) {
                intelligentsync.setSelected(true);
            }

            intelligentsync.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    configuration.setMencoderIntelligentSync((e.getStateChange() == ItemEvent.SELECTED));
                    textAreaDefault.setEnabled(configuration.isMencoderIntelligentSync());

                }
            });

            JLabel label = new JLabel(Messages.getString("MEncoderVideo.33"));
            customPanel.add(label, BorderLayout.NORTH);
            customPanel.add(scrollPane, BorderLayout.SOUTH);

            codecPanel.add(intelligentsync, BorderLayout.NORTH);
            codecPanel.add(scrollPaneDefault, BorderLayout.CENTER);
            codecPanel.add(customPanel, BorderLayout.SOUTH);

            while (JOptionPane.showOptionDialog(
                    SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), codecPanel,
                    Messages.getString("MEncoderVideo.34"), JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.PLAIN_MESSAGE, null, null, null) == JOptionPane.OK_OPTION) {
                String newCodecparam = textArea.getText();
                DLNAMediaInfo fakemedia = new DLNAMediaInfo();
                DLNAMediaAudio audio = new DLNAMediaAudio();
                audio.setCodecA("ac3");
                fakemedia.setCodecV("mpeg4");
                fakemedia.setContainer("matroska");
                fakemedia.setDuration(45d * 60);
                audio.getAudioProperties().setNumberOfChannels(2);
                fakemedia.setWidth(1280);
                fakemedia.setHeight(720);
                audio.setSampleFrequency("48000");
                fakemedia.setFrameRate("23.976");
                fakemedia.getAudioTracksList().add(audio);
                String result[] = getSpecificCodecOptions(newCodecparam, fakemedia,
                        new OutputParams(configuration), "dummy.mpg", "dummy.srt", false, true);

                if (result.length > 0 && result[0].startsWith("@@")) {
                    String errorMessage = result[0].substring(2);
                    JOptionPane.showMessageDialog(
                            SwingUtilities.getWindowAncestor((Component) PMS.get().getFrame()), errorMessage,
                            Messages.getString("Dialog.Error"), JOptionPane.ERROR_MESSAGE);
                } else {
                    configuration.setMencoderCodecSpecificConfig(newCodecparam);
                    break;
                }
            }
        }
    });
    builder.add(button, FormLayoutUtil.flip(cc.xy(1, 11), colSpec, orientation));

    forcefps = new JCheckBox(Messages.getString("MEncoderVideo.4"));
    forcefps.setContentAreaFilled(false);
    if (configuration.isMencoderForceFps()) {
        forcefps.setSelected(true);
    }
    forcefps.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderForceFps(e.getStateChange() == ItemEvent.SELECTED);
        }
    });

    builder.add(forcefps, FormLayoutUtil.flip(cc.xyw(1, 7, 2), colSpec, orientation));

    yadif = new JCheckBox(Messages.getString("MEncoderVideo.26"));
    yadif.setContentAreaFilled(false);
    if (configuration.isMencoderYadif()) {
        yadif.setSelected(true);
    }
    yadif.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderYadif(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(yadif, FormLayoutUtil.flip(cc.xyw(3, 7, 7), colSpec, orientation));

    scaler = new JCheckBox(Messages.getString("MEncoderVideo.27"));
    scaler.setContentAreaFilled(false);
    scaler.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderScaler(e.getStateChange() == ItemEvent.SELECTED);
            scaleX.setEnabled(configuration.isMencoderScaler());
            scaleY.setEnabled(configuration.isMencoderScaler());
        }
    });
    builder.add(scaler, FormLayoutUtil.flip(cc.xyw(3, 5, 7), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.28"), FormLayoutUtil
            .flip(cc.xy(9, 5, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));
    scaleX = new JTextField("" + configuration.getMencoderScaleX());
    scaleX.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            try {
                configuration.setMencoderScaleX(Integer.parseInt(scaleX.getText()));
            } catch (NumberFormatException nfe) {
                logger.debug("Could not parse scaleX from \"" + scaleX.getText() + "\"");
            }
        }
    });
    builder.add(scaleX, FormLayoutUtil.flip(cc.xy(11, 5), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.30"), FormLayoutUtil
            .flip(cc.xy(13, 5, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));
    scaleY = new JTextField("" + configuration.getMencoderScaleY());
    scaleY.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            try {
                configuration.setMencoderScaleY(Integer.parseInt(scaleY.getText()));
            } catch (NumberFormatException nfe) {
                logger.debug("Could not parse scaleY from \"" + scaleY.getText() + "\"");
            }
        }
    });
    builder.add(scaleY, FormLayoutUtil.flip(cc.xy(15, 5), colSpec, orientation));

    if (configuration.isMencoderScaler()) {
        scaler.setSelected(true);
    } else {
        scaleX.setEnabled(false);
        scaleY.setEnabled(false);
    }

    builder.addLabel(Messages.getString("MEncoderVideo.6"),
            FormLayoutUtil.flip(cc.xy(1, 13), colSpec, orientation));
    mencoder_custom_options = new JTextField(configuration.getMencoderCustomOptions());
    mencoder_custom_options.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderCustomOptions(mencoder_custom_options.getText());
        }
    });
    builder.add(mencoder_custom_options, FormLayoutUtil.flip(cc.xyw(3, 13, 13), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.93"),
            FormLayoutUtil.flip(cc.xy(1, 15), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.28") + " (%)", FormLayoutUtil
            .flip(cc.xy(1, 15, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));
    ocw = new JTextField(configuration.getMencoderOverscanCompensationWidth());
    ocw.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderOverscanCompensationWidth(ocw.getText());
        }
    });
    builder.add(ocw, FormLayoutUtil.flip(cc.xy(3, 15), colSpec, orientation));

    builder.addLabel(Messages.getString("MEncoderVideo.30") + " (%)",
            FormLayoutUtil.flip(cc.xy(5, 15), colSpec, orientation));
    och = new JTextField(configuration.getMencoderOverscanCompensationHeight());
    och.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderOverscanCompensationHeight(och.getText());
        }
    });
    builder.add(och, FormLayoutUtil.flip(cc.xy(7, 15), colSpec, orientation));

    cmp = builder.addSeparator(Messages.getString("MEncoderVideo.8"),
            FormLayoutUtil.flip(cc.xyw(1, 17, 15), colSpec, orientation));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    builder.addLabel(Messages.getString("MEncoderVideo.16"), FormLayoutUtil
            .flip(cc.xy(1, 27, CellConstraints.RIGHT, CellConstraints.CENTER), colSpec, orientation));

    mencoder_noass_scale = new JTextField(configuration.getMencoderNoAssScale());
    mencoder_noass_scale.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssScale(mencoder_noass_scale.getText());
        }
    });

    builder.addLabel(Messages.getString("MEncoderVideo.17"),
            FormLayoutUtil.flip(cc.xy(5, 27), colSpec, orientation));

    mencoder_noass_outline = new JTextField(configuration.getMencoderNoAssOutline());
    mencoder_noass_outline.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssOutline(mencoder_noass_outline.getText());
        }
    });

    builder.addLabel(Messages.getString("MEncoderVideo.18"),
            FormLayoutUtil.flip(cc.xy(9, 27), colSpec, orientation));

    mencoder_noass_blur = new JTextField(configuration.getMencoderNoAssBlur());
    mencoder_noass_blur.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssBlur(mencoder_noass_blur.getText());
        }
    });

    builder.addLabel(Messages.getString("MEncoderVideo.19"),
            FormLayoutUtil.flip(cc.xy(13, 27), colSpec, orientation));

    mencoder_noass_subpos = new JTextField(configuration.getMencoderNoAssSubPos());
    mencoder_noass_subpos.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderNoAssSubPos(mencoder_noass_subpos.getText());
        }
    });

    builder.add(mencoder_noass_scale, FormLayoutUtil.flip(cc.xy(3, 27), colSpec, orientation));
    builder.add(mencoder_noass_outline, FormLayoutUtil.flip(cc.xy(7, 27), colSpec, orientation));
    builder.add(mencoder_noass_blur, FormLayoutUtil.flip(cc.xy(11, 27), colSpec, orientation));
    builder.add(mencoder_noass_subpos, FormLayoutUtil.flip(cc.xy(15, 27), colSpec, orientation));

    ass = new JCheckBox(Messages.getString("MEncoderVideo.20"));
    ass.setContentAreaFilled(false);
    ass.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e != null) {
                configuration.setMencoderAss(e.getStateChange() == ItemEvent.SELECTED);
            }
        }
    });
    builder.add(ass, FormLayoutUtil.flip(cc.xy(1, 23), colSpec, orientation));
    ass.setSelected(configuration.isMencoderAss());
    ass.getItemListeners()[0].itemStateChanged(null);

    fc = new JCheckBox(Messages.getString("MEncoderVideo.21"));
    fc.setContentAreaFilled(false);
    fc.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderFontConfig(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(fc, FormLayoutUtil.flip(cc.xyw(3, 23, 5), colSpec, orientation));
    fc.setSelected(configuration.isMencoderFontConfig());

    assdefaultstyle = new JCheckBox(Messages.getString("MEncoderVideo.36"));
    assdefaultstyle.setContentAreaFilled(false);
    assdefaultstyle.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setMencoderAssDefaultStyle(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    builder.add(assdefaultstyle, FormLayoutUtil.flip(cc.xyw(8, 23, 4), colSpec, orientation));
    assdefaultstyle.setSelected(configuration.isMencoderAssDefaultStyle());

    builder.addLabel(Messages.getString("MEncoderVideo.92"),
            FormLayoutUtil.flip(cc.xy(1, 29), colSpec, orientation));
    subq = new JTextField(configuration.getMencoderVobsubSubtitleQuality());
    subq.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setMencoderVobsubSubtitleQuality(subq.getText());
        }
    });
    builder.add(subq, FormLayoutUtil.flip(cc.xyw(3, 29, 1), colSpec, orientation));

    configuration.addConfigurationListener(new ConfigurationListener() {
        @Override
        public void configurationChanged(ConfigurationEvent event) {
            if (event.getPropertyName() == null) {
                return;
            }
            if ((!event.isBeforeUpdate())
                    && event.getPropertyName().equals(PmsConfiguration.KEY_DISABLE_SUBTITLES)) {
                boolean enabled = !configuration.isDisableSubtitles();
                ass.setEnabled(enabled);
                assdefaultstyle.setEnabled(enabled);
                fc.setEnabled(enabled);
                mencoder_noass_scale.setEnabled(enabled);
                mencoder_noass_outline.setEnabled(enabled);
                mencoder_noass_blur.setEnabled(enabled);
                mencoder_noass_subpos.setEnabled(enabled);
                ocw.setEnabled(enabled);
                och.setEnabled(enabled);
                subq.setEnabled(enabled);

                if (enabled) {
                    ass.getItemListeners()[0].itemStateChanged(null);
                }
            }
        }
    });

    JPanel panel = builder.getPanel();

    // Apply the orientation to the panel and all components in it
    panel.applyComponentOrientation(orientation);

    return panel;
}

From source file:levelBuilder.DialogMaker.java

/**
 * Provides other action buttons./*w w w  . ja  v  a 2s .  c o  m*/
 */
private static void actionWindow() {
    //Performs actions based on button pushes.
    class ActionHandler implements ActionListener {
        @Override
        public void actionPerformed(ActionEvent e) {
            switch (e.getActionCommand()) {
            case "edge":
                if (addedEdgeID != 0.0) {
                    DialogNode n = g.getSource(addedEdgeID);
                    int length;
                    if (n.getChildren().length == 0)
                        length = 0;
                    else
                        length = n.getChildren().length;
                    DialogNode[] newChildren = new DialogNode[length + 1];
                    for (int c = 0; c < newChildren.length - 1; c++)
                        newChildren[c] = n.getChildren()[c];
                    newChildren[newChildren.length - 1] = nodeMap.get(g.getDest(addedEdgeID).getText());
                    n.setChildren(newChildren);
                    addedEdgeID = 0.0;
                }
            case "save":
                saveGraph();
            case "check":
                //Checks for errors and displays them if they exist.
                ArrayList<String> errorList = new ArrayList<String>();
                errorList = dg.check();
                if (errorList.isEmpty()) {
                    JOptionPane.showMessageDialog(null, "No errors!", null, JOptionPane.PLAIN_MESSAGE);
                } else {
                    JPanel panel = new JPanel(new GridLayout(0, 1, 0, 0));
                    for (String error : errorList)
                        panel.add(new JLabel(error));
                    JOptionPane.showMessageDialog(null, panel, "Errors. Fix these to continue.",
                            JOptionPane.PLAIN_MESSAGE);
                }
            case "reload":
                loadGraph(false);
            }
        }
    }

    JPanel panel = new JPanel(new GridLayout(0, 1, 0, 0));

    //Buttons
    JButton button3 = new JButton("New edge");
    button3.setActionCommand("edge");
    button3.addActionListener(new ActionHandler());
    panel.add(button3);

    JButton button6 = new JButton("Save");
    button6.setActionCommand("save");
    button6.addActionListener(new ActionHandler());
    panel.add(button6);

    JButton button7 = new JButton("Check");
    button7.setActionCommand("check");
    button7.addActionListener(new ActionHandler());
    panel.add(button7);

    JButton button1 = new JButton("Reload");
    button1.setActionCommand("reload");
    button1.addActionListener(new ActionHandler());
    panel.add(button1);

    JFrame frame = new JFrame("Other Input");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(panel);
    frame.pack();
    frame.setLocation(windowWidth + horizontalWindowPlacement, 0);
    frame.setVisible(true);
}

From source file:gui.MainGUI.java

public void runComplete() {
    buttonStart.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonPlay.png")));
    RUNMODE = runMode.stopped;/*  ww  w  .ja  v a  2  s  .c om*/
    simulation.kill();
    simulation = null;
    JOptionPane.showMessageDialog(new JFrame(),
            "The run has finished.  There are no new position for the robots to move to.", "Run complete",
            JOptionPane.PLAIN_MESSAGE);
}

From source file:com.evanbelcher.DrillBook.display.DBMenuBar.java

/**
 * Changes the font size to what the user selects (between 8-30)
 *///w w w .j  av a  2s  .co m
private void changeFontSize() {
    Integer[] nums = new Integer[23];
    for (int i = 8; i <= 30; i++) {
        nums[i - 8] = i;
    }
    try {
        int size = (int) JOptionPane.showInputDialog(this, "Choose a font size:", "Font Size",
                JOptionPane.PLAIN_MESSAGE, null, nums, Main.getState().getSettings().getFontSize());
        FontUIResource font = new FontUIResource("Dialog", Font.BOLD, size);

        Main.setUIFont(font);
        Main.getState().getSettings().setFontSize(size);
        SwingUtilities.updateComponentTreeUI(gr);

        for (JInternalFrame i : desktop.getAllFrames())
            i.pack();

    } catch (NullPointerException e) {
        e.printStackTrace();
    }
}

From source file:it.imtech.configuration.StartWizard.java

/**
 * Retrieve online configuration filepath
 *
 * @throws MalformedURLException/*from  ww w  .j  av  a2 s .  co m*/
 * @throws ConfigurationException
 */
private XMLConfiguration setConfigurationPaths(XMLConfiguration internalConf, ResourceBundle bundle) {
    XMLConfiguration configuration = null;

    try {
        String text = Utility.getBundleString("setconf", bundle);
        String title = Utility.getBundleString("setconf2", bundle);

        internalConf.setAutoSave(true);

        String n = internalConf.getString("configurl[@path]");

        if (n.isEmpty()) {
            String s = (String) JOptionPane.showInputDialog(new Frame(), text, title, JOptionPane.PLAIN_MESSAGE,
                    null, null, "http://phaidrastatic.cab.unipd.it/xml/config.xml");

            //If a string was returned, say so.
            if ((s != null) && (s.length() > 0)) {
                internalConf.setProperty("configurl[@path]", s);
                Globals.URL_CONFIG = new URL(s);
            } else {
                logger.info("File di configurazione non settato");
            }
        } else {
            if (Globals.ONLINE) {
                Globals.URL_CONFIG = new URL(n);
            }
        }

        if (Globals.URL_CONFIG != null) {
            if (Globals.DEBUG)
                configuration = new XMLConfiguration(new File(Globals.JRPATH + Globals.DEBUG_XML));
            else
                configuration = new XMLConfiguration(Globals.URL_CONFIG);
        } else {
            if (!Globals.ONLINE) {
                configuration = new XMLConfiguration(
                        new File(Globals.USER_DIR + Utility.getSep() + Globals.FOLD_XML + "config.xml"));
            }
        }
    } catch (final MalformedURLException ex) {
        logger.error(ex.getMessage());
        JOptionPane.showMessageDialog(new Frame(), Utility.getBundleString("exc_conf_1", bundle));
    } catch (final ConfigurationException ex) {
        logger.error(ex.getMessage());
        JOptionPane.showMessageDialog(new Frame(), Utility.getBundleString("exc_conf_2", bundle));
    }

    return configuration;
}

From source file:com.nwn.NwnUpdaterHomeView.java

/**
 * Add server and save it to config/*from  w w w . j  a v a  2s . co  m*/
 * Ensure the server name and url are valid and follow the same pattern 
 * that we expect to read from the config
 * @param evt 
 */
private void btnAddServerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddServerActionPerformed
    //Regex validation is here to make sure we can read the config later. 
    //this should be changed both here and on the config object
    //todo: enum for regex values
    String newServerName, newServerFileUrl = null;
    String[] schemes = { "http", "https" };
    UrlValidator urlValidator = new UrlValidator(schemes);
    String nameMessage = "Server Name:\n";
    String urlMessage = "Server File URL:\n";
    do {
        newServerName = (String) JOptionPane.showInputDialog(null, nameMessage, "Add Server",
                JOptionPane.PLAIN_MESSAGE);
        if (newServerName == null) {
            break;
        }
        if (newServerName.contains(",")) {
            nameMessage = "Name cannot have commas:\n";
            newServerName = "";
        }
    } while ((newServerName.length() == 0));
    do {
        if (newServerName == null) {
            break;
        }
        newServerFileUrl = (String) JOptionPane.showInputDialog(null, urlMessage, "Add Server",
                JOptionPane.PLAIN_MESSAGE);
        if (newServerFileUrl == null) {
            break;
        }
        if (!urlValidator.isValid(newServerFileUrl)) {
            urlMessage = "Please Enter Valid Url:\n";
            newServerFileUrl = "";
        }
    } while ((newServerFileUrl.length() == 0));
    if (newServerName != null && newServerFileUrl != null) {
        try {
            ServerInfo newServer = new ServerInfo(newServerName, new URL(newServerFileUrl));
            config.getServerList().add(newServer);
            cmbServerList.addItem(newServer);
            nwnUpdaterConfig.getInstance().save();
        } catch (Exception ex) {
            //            ex.printStackTrace();
            appendOutputText("\nERROR: Unknown error occured, cannot add server: " + newServerName);
        }
    }
}

From source file:org.fhaes.jsea.JSEAFrame.java

/**
 * Initialize the menu/toolbar actions./* www. j a  va2s .c om*/
 */
private void initActions() {

    final JFrame glue = this;

    actionFileExit = new FHAESAction("Close", "close.png") { //$NON-NLS-1$

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            dispose();
        }
    };

    actionChartProperties = new FHAESAction("Chart properties", "properties.png") { //$NON-NLS-1$

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            ChartEditor editor = ChartEditorManager
                    .getChartEditor(jsea.getChartList().get(segmentComboBox.getSelectedIndex()).getChart());
            int result = JOptionPane.showConfirmDialog(glue, editor, "Properties", JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.PLAIN_MESSAGE);
            if (result == JOptionPane.OK_OPTION) {
                editor.updateChart(jsea.getChartList().get(segmentComboBox.getSelectedIndex()).getChart());
            }
        }
    };

    actionReset = new FHAESAction("Reset", "filenew.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            Object[] options = { "Yes", "No", "Cancel" };
            int n = JOptionPane.showOptionDialog(glue, "Are you sure you want to start a new analysis?",
                    "Confirm", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options,
                    options[2]);

            if (n == JOptionPane.YES_OPTION) {
                setToDefault();
            }
        }
    };

    actionRun = new FHAESAction("Run analysis", "run.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            runAnalysis();
        }
    };

    actionSaveAll = new FHAESAction("Save all results", "save_all.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            if (jsea == null)
                return;

            File file;
            JFileChooser fc;

            // Open file chooser in last folder if possible
            if (App.prefs.getPref(PrefKey.PREF_LAST_EXPORT_FOLDER, null) != null) {
                fc = new JFileChooser(App.prefs.getPref(PrefKey.PREF_LAST_EXPORT_FOLDER, null));
            } else {
                fc = new JFileChooser();
            }

            fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

            // Show dialog and get specified file
            int returnVal = fc.showSaveDialog(glue);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                file = fc.getSelectedFile();
                App.prefs.setPref(PrefKey.PREF_LAST_EXPORT_FOLDER, file.getAbsolutePath());
            } else {
                return;
            }

            File f;
            try {
                f = new File(file.getAbsolutePath() + File.separator + "report.txt");
                saveReportTXT(f);

                f = new File(file.getAbsolutePath() + File.separator + "report.pdf");
                saveReportPDF(f);

                f = new File(file.getAbsolutePath() + File.separator + "chart.png");
                saveChartPNG(f);

                f = new File(file.getAbsolutePath() + File.separator + "chart.pdf");
                saveChartPDF(f);

                f = new File(file.getAbsolutePath() + File.separator + "data.xls");
                saveDataXLS(f);

                f = new File(file.getAbsolutePath());
                saveDataCSV(f);

            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };

    actionSaveData = new FHAESAction("Save data tables", "table.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            if (jsea == null)
                return;

            File file;
            JFileChooser fc;

            // Open file chooser in last folder if possible
            if (App.prefs.getPref(PrefKey.PREF_LAST_EXPORT_FOLDER, null) != null) {
                fc = new JFileChooser(App.prefs.getPref(PrefKey.PREF_LAST_EXPORT_FOLDER, null));
            } else {
                fc = new JFileChooser();
            }

            fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

            // Show dialog and get specified file
            int returnVal = fc.showSaveDialog(glue);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                file = fc.getSelectedFile();
                App.prefs.setPref(PrefKey.PREF_LAST_EXPORT_FOLDER, file.getAbsolutePath());
            } else {
                return;
            }

            try {
                saveDataCSV(file);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };

    actionSaveReport = new FHAESAction("Save report", "report.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            if (jsea == null)
                return;

            File file;
            JFileChooser fc;

            // Open file chooser in last folder if possible
            if (App.prefs.getPref(PrefKey.PREF_LAST_EXPORT_FOLDER, null) != null) {
                fc = new JFileChooser(App.prefs.getPref(PrefKey.PREF_LAST_EXPORT_FOLDER, null));
            } else {
                fc = new JFileChooser();
            }

            // Set file filters
            fc.setAcceptAllFileFilterUsed(false);
            TXTFileFilter txtfilter = new TXTFileFilter();
            PDFFilter pdffilter = new PDFFilter();
            fc.addChoosableFileFilter(txtfilter);
            fc.addChoosableFileFilter(pdffilter);
            fc.setFileFilter(txtfilter);
            FileFilter chosenFilter;

            // Show dialog and get specified file
            int returnVal = fc.showSaveDialog(glue);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                file = fc.getSelectedFile();
                chosenFilter = fc.getFileFilter();
                App.prefs.setPref(PrefKey.PREF_LAST_EXPORT_FOLDER, file.getAbsolutePath());
            } else {
                return;
            }

            // Handle file type and extensions nicely
            if (FilenameUtils.getExtension(file.getAbsolutePath()).equals("")) {
                if (chosenFilter.equals(txtfilter)) {
                    file = new File(file.getAbsoluteFile() + ".txt");
                } else if (chosenFilter.equals(pdffilter)) {
                    file = new File(file.getAbsoluteFile() + ".pdf");
                }
            } else if (FilenameUtils.getExtension(file.getAbsolutePath()).toLowerCase().equals("txt")
                    && chosenFilter.equals("pdf")) {
                chosenFilter = txtfilter;
            } else if (FilenameUtils.getExtension(file.getAbsolutePath()).toLowerCase().equals("pdf")
                    && chosenFilter.equals("txt")) {
                chosenFilter = pdffilter;
            }

            // If file already exists confirm overwrite
            if (file.exists()) {
                // Check we have write access to this file
                if (!file.canWrite()) {
                    JOptionPane.showMessageDialog(glue, "You do not have write permission to this file",
                            "Error", JOptionPane.ERROR_MESSAGE);
                    return;
                }

                int n = JOptionPane.showConfirmDialog(glue,
                        "File: " + file.getName() + " already exists. " + "Would you like to overwrite it?",
                        "Overwrite file?", JOptionPane.YES_NO_OPTION);
                if (n != JOptionPane.YES_OPTION) {
                    return;
                }
            }

            // Do save
            try {

                if (chosenFilter.equals(txtfilter)) {
                    saveReportTXT(file);
                } else if (chosenFilter.equals(pdffilter)) {
                    saveReportPDF(file);
                } else {
                    log.error("No export file format chosen.  Shouldn't be able to get here!");
                }
            } catch (IOException e) {
                JOptionPane.showMessageDialog(glue, "Unable to save report.  Check log file.", "Warning",
                        JOptionPane.ERROR_MESSAGE);
                e.printStackTrace();
            }

        }
    };

    actionSaveChart = new FHAESAction("Save chart", "barchart.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            if (jsea == null)
                return;

            File file;
            JFileChooser fc;

            // Open file chooser in last folder if possible
            if (App.prefs.getPref(PrefKey.PREF_LAST_EXPORT_FOLDER, null) != null) {
                fc = new JFileChooser(App.prefs.getPref(PrefKey.PREF_LAST_EXPORT_FOLDER, null));
            } else {
                fc = new JFileChooser();
            }

            // Set file filters
            fc.setAcceptAllFileFilterUsed(false);
            PNGFilter pngfilter = new PNGFilter();
            PDFFilter pdffilter = new PDFFilter();
            fc.addChoosableFileFilter(pngfilter);
            fc.addChoosableFileFilter(pdffilter);
            fc.setFileFilter(pngfilter);
            FileFilter chosenFilter;

            // Show dialog and get specified file
            int returnVal = fc.showSaveDialog(glue);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                file = fc.getSelectedFile();
                chosenFilter = fc.getFileFilter();
                App.prefs.setPref(PrefKey.PREF_LAST_EXPORT_FOLDER, file.getAbsolutePath());
            } else {
                return;
            }

            // Handle file type and extensions nicely
            if (FilenameUtils.getExtension(file.getAbsolutePath()).equals("")) {
                if (chosenFilter.equals(pngfilter)) {
                    file = new File(file.getAbsoluteFile() + ".png");
                } else if (chosenFilter.equals(pdffilter)) {
                    file = new File(file.getAbsoluteFile() + ".pdf");
                }
            } else if (FilenameUtils.getExtension(file.getAbsolutePath()).toLowerCase().equals("png")
                    && chosenFilter.equals("pdf")) {
                chosenFilter = pngfilter;
            } else if (FilenameUtils.getExtension(file.getAbsolutePath()).toLowerCase().equals("pdf")
                    && chosenFilter.equals("png")) {
                chosenFilter = pdffilter;
            }

            // If file already exists confirm overwrite
            if (file.exists()) {
                // Check we have write access to this file
                if (!file.canWrite()) {
                    JOptionPane.showMessageDialog(glue, "You do not have write permission to this file",
                            "Error", JOptionPane.ERROR_MESSAGE);
                    return;
                }

                int n = JOptionPane.showConfirmDialog(glue,
                        "File: " + file.getName() + " already exists. " + "Would you like to overwrite it?",
                        "Overwrite file?", JOptionPane.YES_NO_OPTION);
                if (n != JOptionPane.YES_OPTION) {
                    return;
                }
            }

            // Do save
            try {

                if (chosenFilter.equals(pngfilter)) {
                    saveChartPNG(file);

                } else if (chosenFilter.equals(pdffilter)) {

                    saveChartPDF(file);
                } else {
                    log.error("No export file format chosen.  Shouldn't be able to get here!");
                }
            } catch (IOException e) {
                JOptionPane.showMessageDialog(glue, "Unable to save chart.  Check log file.", "Warning",
                        JOptionPane.ERROR_MESSAGE);
                e.printStackTrace();
            }

        }
    };

    actionCopy = new FHAESAction("Copy", "edit_copy.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            copyCurrentSelectionToClipboard();
        }
    };

    actionLagMap = new FHAESAction("LagMap", "lagmap22.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            launchLagMap();
        }
    };

}

From source file:edu.harvard.i2b2.query.QueryTopPanel.java

private void jRunQueryButtonActionPerformed(java.awt.event.ActionEvent evt) {
    //System.out.println("value set on the slider: "+ jSlider1.getValue());
    if (dataModel.isAllPanelEmpty()) {
        JOptionPane.showMessageDialog(this, "All groups are empty.");
        return;/*from ww w  .java  2 s.c  om*/
    }

    String queryNametmp = jNameTextField.getText();
    //if(queryNametmp.equals("") || queryNametmp == null) {
    queryNametmp = dataModel.getTmpQueryName();
    //}
    Object selectedValue = JOptionPane.showInputDialog(this, "Please supply a name for this query: ",
            "Query Name Dialog", JOptionPane.PLAIN_MESSAGE, null, null, queryNametmp);

    if (selectedValue == null) {
        return;
    } else {
        queryNametmp = (String) selectedValue;
    }

    dataModel.queryName(queryNametmp);
    final String queryName = queryNametmp;
    //System.out.println("Provided query name: " + queryName);

    ImageIcon buttonIcon = createImageIcon("indicator_18.gif");
    this.jRunQueryButton.setIcon(buttonIcon);
    this.jRunQueryButton.setText("         Running ......");
    final Color defaultcolor = jRunQueryButton.getBackground();

    dataModel.specificity(0);//jSlider1.getValue());
    final String xmlStr = dataModel.wirteQueryXML();
    parentPanel.lastRequestMessage(xmlStr);
    parentPanel.setPatientCount("");
    parentPanel.setRequestText(xmlStr);
    parentPanel.setResponseText("Waiting for response ...");
    //System.out.println("Query request: "+xmlStr);
    jNameTextField.setText(queryName);

    queryThread = new Thread() {
        public void run() {
            //setCursor(new Cursor(Cursor.WAIT_CURSOR));
            response = QueryRequestClient.sendQueryRequestREST(xmlStr);
            parentPanel.lastResponseMessage(response);
            if (response != null) {
                //response = response.substring(response.indexOf("<ns2:response"), response.indexOf("</i2b2:response>"));
                parentPanel.setResponseText(response);
                JAXBUtil jaxbUtil = QueryJAXBUtil.getJAXBUtil();

                try {
                    JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response);
                    ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue();
                    BodyType bt = messageType.getMessageBody();
                    MasterInstanceResultResponseType masterInstanceResultResponseType = (MasterInstanceResultResponseType) new JAXBUnWrapHelper()
                            .getObjectByClass(bt.getAny(), MasterInstanceResultResponseType.class);
                    String queryId = null;
                    //ResponseMessageType messageType = jaxbUtil.unMashallResponseMessageTypeFromString(response);
                    StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus();
                    String status = statusType.getType();
                    queryId = new Integer(masterInstanceResultResponseType.getQueryMaster().getQueryMasterId())
                            .toString();//messageType.getResponseHeader().getInfo().getValue();
                    //System.out.println("Get query id: "+queryId);

                    QueryMasterData nameNode = new QueryMasterData();
                    nameNode.name(queryName);
                    nameNode.visualAttribute("CA");
                    nameNode.userId(UserInfoBean.getInstance().getUserName());
                    nameNode.tooltip("A query run by " + nameNode.userId());
                    nameNode.id(queryId);
                    //nameNode.xmlContent(xmlStr);

                    String count = "";
                    if (status.equalsIgnoreCase("DONE")) {
                        String refId = null;
                        try {
                            edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.StatusType cellStatusType = masterInstanceResultResponseType
                                    .getStatus();
                            if (cellStatusType.getCondition().get(0).getValue().equalsIgnoreCase("RUNNING")) {
                                JOptionPane.showMessageDialog(parentPanel,
                                        "Query is still running, you may check its status later \n"
                                                + "in the previous queries view by right clicking on a node\n"
                                                + "then selecting refresh all.");
                                jRunQueryButton.setIcon(null);
                                jRunQueryButton.setText("Run Query");
                                return;
                            } else if (cellStatusType.getCondition().get(0).getValue()
                                    .equalsIgnoreCase("ERROR")) {
                                JOptionPane.showMessageDialog(parentPanel,
                                        "Error message delivered from the remote server, "
                                                + "you may wish to retry your last action");
                                jRunQueryButton.setIcon(null);
                                jRunQueryButton.setText("Run Query");
                                return;
                            }

                            QueryResultInstanceType queryResultInstanceType = masterInstanceResultResponseType
                                    .getQueryResultInstance().get(0);
                            refId = new Integer(queryResultInstanceType.getResultInstanceId()).toString();
                            //System.out.println("Set Ref id: "+ refId);
                            count = new Integer(queryResultInstanceType.getSetSize()).toString();
                            parentPanel.setPatientCount(count);
                        } catch (Exception e) {
                            e.printStackTrace();
                            JOptionPane.showMessageDialog(parentPanel,
                                    "Response delivered from the remote server could not be understood,\n"
                                            + "you may wish to retry your last action.");

                            jRunQueryButton.setIcon(null);
                            jRunQueryButton.setText("Run Query");
                            return;
                        }

                        IWorkbenchPage page = ((QueryPanelInvestigator) parentPanel).parentview.getViewSite()
                                .getPage();
                        ViewPart previousqueryview = (ViewPart) page.findView(
                                "edu.harvard.i2b2.eclipse.plugins.previousquery.views.PreviousQueryView");
                        ((ICommonMethod) previousqueryview).doSomething(nameNode.name() + " ["
                                + dataModel.getDayString() + "]" + "#i2b2seperater#" + nameNode.id());

                        ArrayList<String> nodeXmls = new ArrayList<String>();
                        for (int i = 0; i < dataModel.getCurrentPanelCount(); i++) {
                            ArrayList<QueryConceptTreeNodeData> nodelist = dataModel.getTreePanel(i).getItems();
                            for (int j = 0; j < nodelist.size(); j++) {
                                QueryConceptTreeNodeData nodedata = nodelist.get(j);
                                String termStatus = nodedata.setXmlContent();
                                if (termStatus.equalsIgnoreCase("error")) {
                                    JOptionPane.showMessageDialog(parentPanel,
                                            "Response delivered from the remote server could not be understood,\n"
                                                    + "you may wish to retry your last action.");
                                    jRunQueryButton.setIcon(null);
                                    jRunQueryButton.setText("Run Query");
                                    return;
                                }
                                nodeXmls.add(nodedata.xmlContent());
                            }
                        }

                        ViewPart explorerview = (ViewPart) page
                                .findView("edu.harvard.i2b2.eclipse.plugins.explorer.views.ExplorerView");
                        String str1 = "" + count;
                        String str2 = "-" + refId;
                        ((ICommonMethod) explorerview).doSomething(str1 + str2);
                        ((ICommonMethod) explorerview).doSomething(nodeXmls);
                    } else {
                        JOptionPane.showMessageDialog(parentPanel,
                                "Error message delivered from the remote server, "
                                        + "you may wish to retry your last action");

                        jRunQueryButton.setIcon(null);
                        jRunQueryButton.setText("Run Query");
                        return;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    JOptionPane.showMessageDialog(parentPanel,
                            "Response delivered from the remote server could not be understood,\n"
                                    + "you may wish to retry your last action.");
                    jRunQueryButton.setIcon(null);
                    jRunQueryButton.setText("Run Query");
                    return;
                }
            }
            //setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
            jRunQueryButton.setIcon(null);
            jRunQueryButton.setText("Run Query");
            //jRunQueryButton.setBackground(defaultcolor);
        }
    };

    try {
        queryThread.start();
    } catch (Exception e) {
        e.printStackTrace();
        parentPanel.setResponseText(e.getMessage());
    }
}