Example usage for javax.swing JTextArea setText

List of usage examples for javax.swing JTextArea setText

Introduction

In this page you can find the example usage for javax.swing JTextArea setText.

Prototype

@BeanProperty(bound = false, description = "the text of this component")
public void setText(String t) 

Source Link

Document

Sets the text of this TextComponent to the specified text.

Usage

From source file:phex.gui.dialogs.LogBufferDialog.java

/**
 * // w w w.  j  a v  a2 s .  c om
 */
private void prepareComponent() {
    CloseEventHandler closeEventHandler = new CloseEventHandler();
    addWindowListener(closeEventHandler);

    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());
    JPanel contentPanel = new JPanel();
    //JPanel contentPanel = new FormDebugPanel();
    contentPane.add(contentPanel, BorderLayout.CENTER);

    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("4dlu, fill:d:grow, 4dlu", // columns
            "p, p, 2dlu, fill:p:grow, 4dlu, p, 4dlu"); //row
    PanelBuilder contentPB = new PanelBuilder(layout, contentPanel);

    DialogBanner banner = new DialogBanner(Localizer.getString("LogBufferDialog_Log"),
            Localizer.getString("LogBufferDialog_DisplayLog"));
    contentPB.add(banner, cc.xywh(1, 1, 3, 1));

    contentPB.add(new JSeparator(), cc.xywh(1, 2, 3, 1));

    JTextArea logArea = new JTextArea(40, 100);
    logArea.setEditable(false);
    contentPB.add(new JScrollPane(logArea), cc.xy(2, 4));

    JButton closeBtn = new JButton(Localizer.getString("Close"));
    closeBtn.addActionListener(closeEventHandler);
    contentPB.add(ButtonBarFactory.buildCloseBar(closeBtn), cc.xy(2, 6));

    StringBuffer textBuffer = new StringBuffer();
    Iterator iterator = logEntries.iterator();
    while (iterator.hasNext()) {
        LogRecord record = (LogRecord) iterator.next();
        textBuffer.append(dateFormat.format(new Date(record.getTimestamp()))).append("::")
                .append(record.getMessage()).append(SystemUtils.LINE_SEPARATOR);
    }
    logArea.setText(textBuffer.toString());
    //logArea.setCaretPosition(0);

    pack();
    setLocationRelativeTo(getParent());
}

From source file:pl.otros.logview.exceptionshandler.ShowErrorDialogExceptionHandler.java

@Override
protected void uncaughtExceptionInSwingEDT(Thread thread, Throwable throwable) {
    String stackTraceAsString = Throwables.getStackTraceAsString(throwable);
    if (caughtStackTraces.contains(stackTraceAsString)) {
        LOGGER.info("Not sending the same error report twice");
        return;//w  w w . ja v  a  2 s . c om
    }
    caughtStackTraces.add(stackTraceAsString);
    JPanel message = new JPanel(new BorderLayout());
    message.add(new JLabel("Error in thread " + thread.getName()), BorderLayout.NORTH);

    String stackTrace = getStackTrace(throwable);
    JTextArea textArea = new JTextArea(10, 70);
    textArea.setText(stackTrace);
    textArea.setCaretPosition(0);
    message.add(new JScrollPane(textArea));

    JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE);

    Map<String, String> errorReportData = generateReportData(thread, throwable, otrosApplication);
    JComponent jComponent = createDialogView();
    String[] options = { "Send", "Do not send" };
    int sendReport = JOptionPane.showOptionDialog(otrosApplication.getApplicationJFrame(), jComponent,
            "Send error report confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
            Icons.MEGAPHONE_24, options, options[0]);
    errorReportData.put("USER:email", emailTextField.getText());
    errorReportData.put("USER:comment", commentTextArea.getText());

    if (sendReport == JOptionPane.YES_OPTION) {
        DataConfiguration c = otrosApplication.getConfiguration();
        c.setProperty(ConfKeys.HTTP_PROXY_USE, checkBoxUseProxy.isSelected());
        c.setProperty(ConfKeys.HTTP_PROXY_HOST, proxyTf.getText());
        c.setProperty(ConfKeys.HTTP_PROXY_PORT, proxyPortModel.getNumber().intValue());
        c.setProperty(ConfKeys.HTTP_PROXY_USER, proxyUser.getText());
        sendReportInNewBackground(errorReportData);
    } else {
        LOGGER.info("Not sending error report");
    }

    logErrorReport(errorReportData);

}

From source file:qic.ui.AboutPanel.java

public AboutPanel() {
    BoxLayout boxLayout = new BoxLayout(this, BoxLayout.PAGE_AXIS);
    setLayout(boxLayout);/*from ww  w .j a  va 2 s .  com*/

    JLabel aboutLbl = new JLabel("<html>" + "<p>Durian Copyright (C) 2015 thirdy</p>"
            + "<p>This program is free software: you can redistribute it and/or modify</p>"
            + "<p>it under the terms of the GNU General Public License as published by</p>"
            + "<p>the Free Software Foundation, either version 3 of the License, or</p>"
            + "<p>(at your option) any later version.</p>"
            + "<p>This program comes with ABSOLUTELY NO WARRANTY.</p>"
            + "<p>A copy of the GNU General Public License can be found at https://github.com/thirdy/durian/blob/master/LICENSE</p>"
            + "<br/>" + "<br/>"
            + "<p>Thank you for using Durian. Durian is a fan-made software and is not affiliated with Grinding Gear Games in any way.</p>"
            + "<p>This software is 100% free and open source.</p>"
            + "<p>Durian is a fan-made software and is not affiliated with Grinding Gear Games in any way.</p>"
            + "<br/>" + "<br/>" + "<p>IGN: ManicCompression</p>" + "<p>Reddit: /u/ProFalseIdol</p>"
            + "</html>");

    String websiteUrl = "http://thirdy.github.io/durian/";
    JButton website = new JButtonLink("Website: " + websiteUrl, websiteUrl);

    String forumUrl = "https://www.pathofexile.com/forum/view-thread/1507190";
    JButton forum = new JButtonLink("Forum Thread: " + forumUrl, forumUrl);

    String helpUrl = "http://thirdy.github.io/durian/help/help.htm";
    JButton help = new JButtonLink("Search Term Helper: " + helpUrl, helpUrl);

    add(Box.createRigidArea(new Dimension(5, 10)));
    add(aboutLbl);
    add(Box.createRigidArea(new Dimension(5, 10)));
    add(website);
    add(Box.createRigidArea(new Dimension(5, 10)));
    add(forum);
    add(Box.createRigidArea(new Dimension(5, 10)));
    add(help);

    JPanel helpPanel = new JPanel(new BorderLayout());
    helpPanel.setBorder(BorderFactory.createTitledBorder("Help"));
    JTextArea textArea = new JTextArea();
    textArea.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
    try {
        InputStream input = this.getClass().getResource("/help.txt").openStream();
        String str = IOUtils.toString(input);
        textArea.setText(str);
        textArea.setCaretPosition(0);
        input.close();
    } catch (Exception e) {
        logger.error("Error while reading help file", e);
    }
    helpPanel.add(new JScrollPane(textArea), BorderLayout.CENTER);
    add(Box.createRigidArea(new Dimension(5, 10)));
    add(helpPanel);
}

From source file:utybo.branchingstorytree.swing.OpenBSTGUI.java

private JMenu createShortMenu() {
    JMenu shortMenu = new JMenu();
    addDarkModeCallback(b -> {//from w  ww .java  2s . c  o m
        shortMenu.setBackground(b ? OPENBST_BLUE.darker().darker() : OPENBST_BLUE.brighter());
        shortMenu.setForeground(b ? Color.WHITE : OPENBST_BLUE);
    });
    shortMenu.setBackground(OPENBST_BLUE.brighter());
    shortMenu.setForeground(OPENBST_BLUE);
    shortMenu.setText(Lang.get("banner.title"));
    shortMenu.setIcon(new ImageIcon(Icons.getImage("Logo", 16)));
    JMenuItem label = new JMenuItem(Lang.get("menu.title"));
    label.setEnabled(false);
    shortMenu.add(label);
    shortMenu.addSeparator();
    shortMenu.add(
            new JMenuItem(new AbstractAction(Lang.get("menu.open"), new ImageIcon(Icons.getImage("Open", 16))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    openStory(VisualsUtils.askForFile(OpenBSTGUI.this, Lang.get("file.title")));
                }
            }));

    shortMenu.addSeparator();

    shortMenu.add(new JMenuItem(
            new AbstractAction(Lang.get("menu.create"), new ImageIcon(Icons.getImage("Add Property", 16))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    doNewEditor();
                }
            }));

    JMenu additionalMenu = new JMenu(Lang.get("menu.advanced"));
    shortMenu.add(additionalMenu);

    additionalMenu.add(new JMenuItem(
            new AbstractAction(Lang.get("menu.package"), new ImageIcon(Icons.getImage("Open Archive", 16))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    new PackageDialog(instance).setVisible(true);
                }
            }));
    additionalMenu.add(new JMenuItem(
            new AbstractAction(Lang.get("langcheck"), new ImageIcon(Icons.getImage("LangCheck", 16))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    final Map<String, String> languages = new Gson()
                            .fromJson(new InputStreamReader(
                                    OpenBST.class.getResourceAsStream(
                                            "/utybo/branchingstorytree/swing/lang/langs.json"),
                                    StandardCharsets.UTF_8), new TypeToken<Map<String, String>>() {
                                    }.getType());
                    languages.remove("en");
                    languages.remove("default");
                    JComboBox<String> jcb = new JComboBox<>(new Vector<>(languages.keySet()));
                    JPanel panel = new JPanel();
                    panel.add(new JLabel(Lang.get("langcheck.choose")));
                    panel.add(jcb);
                    int result = JOptionPane.showOptionDialog(OpenBSTGUI.this, panel, Lang.get("langcheck"),
                            JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
                    if (result == JOptionPane.OK_OPTION) {
                        Locale selected = new Locale((String) jcb.getSelectedItem());
                        if (!Lang.getMap().keySet().contains(selected)) {
                            try {
                                Lang.loadTranslationsFromFile(selected,
                                        OpenBST.class
                                                .getResourceAsStream("/utybo/branchingstorytree/swing/lang/"
                                                        + languages.get(jcb.getSelectedItem().toString())));
                            } catch (UnrespectedModelException | IOException e1) {
                                LOG.warn("Failed to load translation file", e1);
                            }
                        }
                        ArrayList<String> list = new ArrayList<>();
                        Lang.getLocaleMap(Locale.ENGLISH).forEach((k, v) -> {
                            if (!Lang.getLocaleMap(selected).containsKey(k)) {
                                list.add(k + "\n");
                            }
                        });
                        StringBuilder sb = new StringBuilder();
                        Collections.sort(list);
                        list.forEach(s -> sb.append(s));
                        JDialog dialog = new JDialog(OpenBSTGUI.this, Lang.get("langcheck"));
                        dialog.getContentPane().setLayout(new MigLayout());
                        dialog.getContentPane().add(new JLabel(Lang.get("langcheck.result")),
                                "pushx, growx, wrap");
                        JTextArea area = new JTextArea();
                        area.setLineWrap(true);
                        area.setWrapStyleWord(true);
                        area.setText(sb.toString());
                        area.setEditable(false);
                        area.setBorder(BorderFactory.createLoweredBevelBorder());
                        JScrollPane jsp = new JScrollPane(area);
                        jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
                        dialog.getContentPane().add(jsp, "pushx, pushy, growx, growy");
                        dialog.setSize((int) (Icons.getScale() * 300), (int) (Icons.getScale() * 300));
                        dialog.setLocationRelativeTo(OpenBSTGUI.this);
                        dialog.setModalityType(ModalityType.APPLICATION_MODAL);
                        dialog.setVisible(true);
                    }
                }
            }));

    additionalMenu.add(new JMenuItem(
            new AbstractAction(Lang.get("menu.debug"), new ImageIcon(Icons.getImage("Code", 16))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    DebugInfo.launch(OpenBSTGUI.this);
                }
            }));

    JMenu includedFiles = new JMenu("Included BST files");

    for (Entry<String, String> entry : OpenBST.getInternalFiles().entrySet()) {
        JMenuItem jmi = new JMenuItem(entry.getKey());
        jmi.addActionListener(ev -> {
            String path = "/bst/" + entry.getValue();
            InputStream is = OpenBSTGUI.class.getResourceAsStream(path);
            ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(OpenBSTGUI.this, "Extracting...",
                    is);
            new Thread(() -> {
                try {
                    File f = File.createTempFile("openbstinternal", ".bsp");
                    FileOutputStream fos = new FileOutputStream(f);
                    IOUtils.copy(pmis, fos);
                    openStory(f);
                } catch (final IOException e) {
                    LOG.error("IOException caught", e);
                    showException(Lang.get("file.error").replace("$e", e.getClass().getSimpleName())
                            .replace("$m", e.getMessage()), e);
                }

            }).start();

        });
        includedFiles.add(jmi);
    }
    additionalMenu.add(includedFiles);

    shortMenu.addSeparator();

    JMenu themesMenu = new JMenu(Lang.get("menu.themes"));
    shortMenu.add(themesMenu);
    themesMenu.setIcon(new ImageIcon(Icons.getImage("Color Wheel", 16)));
    ButtonGroup themesGroup = new ButtonGroup();
    JRadioButtonMenuItem jrbmi;

    jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.dark"));
    if (0 == selectedTheme) {
        jrbmi.setSelected(true);
    }
    jrbmi.addActionListener(e -> switchLaF(0, DARK_THEME));
    themesMenu.add(jrbmi);
    themesGroup.add(jrbmi);

    jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.light"));
    if (1 == selectedTheme) {
        jrbmi.setSelected(true);
    }
    jrbmi.addActionListener(e -> switchLaF(1, LIGHT_THEME));
    themesMenu.add(jrbmi);
    themesGroup.add(jrbmi);

    jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.debug"));
    if (2 == selectedTheme) {
        jrbmi.setSelected(true);
    }
    jrbmi.addActionListener(e -> switchLaF(2, DEBUG_THEME));
    themesMenu.add(jrbmi);
    themesGroup.add(jrbmi);

    JMenu additionalLightThemesMenu = new JMenu(Lang.get("menu.themes.morelight"));
    int j = 3;
    for (Map.Entry<String, LookAndFeel> entry : ADDITIONAL_LIGHT_THEMES.entrySet()) {
        int jf = j;
        jrbmi = new JRadioButtonMenuItem(entry.getKey());
        if (j == selectedTheme)
            jrbmi.setSelected(true);
        jrbmi.addActionListener(e -> switchLaF(jf, entry.getValue()));
        additionalLightThemesMenu.add(jrbmi);
        themesGroup.add(jrbmi);
        j++;
    }
    themesMenu.add(additionalLightThemesMenu);

    JMenu additionalDarkThemesMenu = new JMenu(Lang.get("menu.themes.moredark"));
    for (Map.Entry<String, LookAndFeel> entry : ADDITIONAL_DARK_THEMES.entrySet()) {
        int jf = j;
        jrbmi = new JRadioButtonMenuItem(entry.getKey());
        if (j == selectedTheme)
            jrbmi.setSelected(true);
        jrbmi.addActionListener(e -> switchLaF(jf, entry.getValue()));
        additionalDarkThemesMenu.add(jrbmi);
        themesGroup.add(jrbmi);
        j++;
    }
    themesMenu.add(additionalDarkThemesMenu);

    shortMenu.add(new JMenuItem(
            new AbstractAction(Lang.get("menu.about"), new ImageIcon(Icons.getImage("About", 16))) {
                /**
                 *
                 */
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    new AboutDialog(instance).setVisible(true);
                }
            }));

    return shortMenu;
}

From source file:utybo.branchingstorytree.swing.visuals.AboutDialog.java

@SuppressWarnings("unchecked")
public AboutDialog(OpenBSTGUI parent) {
    super(parent);
    setTitle(Lang.get("about.title"));
    setModalityType(ModalityType.APPLICATION_MODAL);

    JPanel banner = new JPanel(new FlowLayout(FlowLayout.CENTER));
    banner.setBackground(OpenBSTGUI.OPENBST_BLUE);
    JLabel lblOpenbst = new JLabel(new ImageIcon(Icons.getImage("FullLogoWhite", 48)));
    lblOpenbst.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    banner.add(lblOpenbst, "flowx,cell 0 0,alignx center");
    getContentPane().add(banner, BorderLayout.NORTH);

    JPanel pan = new JPanel();
    pan.setLayout(new MigLayout("insets 10, gap 10px", "[grow]", "[][][grow]"));
    getContentPane().add(pan, BorderLayout.CENTER);

    JLabel lblWebsite = new JLabel("https://utybo.github.io/BST/");
    Font f = lblWebsite.getFont();
    @SuppressWarnings("rawtypes")
    Map attrs = f.getAttributes();
    attrs.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
    lblWebsite.setFont(f.deriveFont(attrs));
    lblWebsite.setForeground(OpenBSTGUI.OPENBST_BLUE);
    lblWebsite.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblWebsite.addMouseListener(new MouseAdapter() {
        @Override/*from   w w  w .ja  v  a  2  s.co m*/
        public void mouseClicked(MouseEvent e) {
            if (Desktop.isDesktopSupported()) {
                try {
                    Desktop.getDesktop().browse(new URL("https://utybo.github.io/BST/").toURI());
                } catch (IOException | URISyntaxException e1) {
                    OpenBST.LOG.warn("Exception when trying to open website", e1);
                }
            }
        }
    });
    pan.add(lblWebsite, "cell 0 0,alignx center");

    JLabel lblVersion = new JLabel(Lang.get("about.version").replace("$v", OpenBST.VERSION));
    pan.add(lblVersion, "flowy,cell 0 1");

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBorder(new LineBorder(pan.getBackground().darker(), 1, false));
    pan.add(scrollPane, "cell 0 2,grow");

    JTextArea textArea = new JTextArea();
    textArea.setMargin(new Insets(5, 5, 5, 5));
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    textArea.setFont(new Font(textArea.getFont().getFontName(), Font.PLAIN, (int) (Icons.getScale() * 11)));

    try (InputStream in = getClass().getResourceAsStream("/utybo/branchingstorytree/swing/about.txt");) {
        textArea.setText(IOUtils.toString(in, StandardCharsets.UTF_8));
    } catch (IOException ex) {
        OpenBST.LOG.warn("Loading about information failed", ex);
    }
    textArea.setEditable(false);
    textArea.setCaretPosition(0);
    scrollPane.setViewportView(textArea);

    JLabel lblTranslatedBy = new JLabel(Lang.get("author"));
    pan.add(lblTranslatedBy, "cell 0 1");

    setSize((int) (Icons.getScale() * 450), (int) (Icons.getScale() * 400));
    setLocationRelativeTo(parent);
}

From source file:Widgets.Simulation.java

public Simulation(final JFrame aFrame, NetworkElement item) {
    super(aFrame);
    grn = ((DynamicalModelElement) item).getGeneNetwork();
    plot = new Plot2DPanel();

    //closing listener
    this.addWindowListener(new WindowAdapter() {
        @Override/* w ww .ja v  a2 s.  c o m*/
        public void windowClosing(WindowEvent windowEvent) {
            if (simulation != null && simulation.myThread_.isAlive()) {
                simulation.stop();
                System.out.print("Simulation is canceled.\n");
                JOptionPane.showMessageDialog(new Frame(), "Simulation is canceled.", "Warning!",
                        JOptionPane.INFORMATION_MESSAGE);
            }
            escapeAction();
        }
    });

    // Model
    model_.setModel(new DefaultComboBoxModel(new String[] { "Deterministic Model (ODEs)",
            "Stochastic Model (SDEs)", "Stochastic Simulation (Gillespie Algorithm)" }));
    model_.setSelectedIndex(0);

    setModelAction();

    //set plot part
    //display result
    if (grn.getTimeScale().size() >= 1) {
        //update parameters
        numTimeSeries_.setValue(grn.getTraj_itsValue());
        tmax_.setValue(grn.getTraj_maxTime());
        sdeDiffusionCoeff_.setValue(grn.getTraj_noise());

        if (grn.getTraj_model().equals("ode"))
            model_.setSelectedIndex(0);
        else if (grn.getTraj_model().equals("sde"))
            model_.setSelectedIndex(1);
        else
            model_.setSelectedIndex(2);

        //update plot
        trajPlot.removeAll();
        trajPlot.add(trajectoryTabb());
        trajPlot.updateUI();
        trajPlot.setVisible(true);
        trajPlot.repaint();

        analyzeResult.setVisible(true);
    }

    /**
     * ACTIONS
     */

    model_.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            setModelAction();
        }
    });

    analyzeResult.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            final JDialog a = new JDialog();
            a.setSize(new Dimension(500, 450));
            a.setModal(true);
            a.setTitle("Gene List (seperated by ';')");
            a.setLocationRelativeTo(null);

            final JTextArea focusGenesArea = new JTextArea();
            focusGenesArea.setLineWrap(true);
            focusGenesArea.setEditable(false);
            focusGenesArea.setRows(3);

            String geneNames = "";
            for (int i = 0; i < grn.getNodes().size(); i++)
                geneNames += grn.getNodes().get(i).getLabel() + ";";
            focusGenesArea.setText(geneNames);

            JButton submitButton = new JButton("Submit");
            JButton cancelButton = new JButton("Cancel");
            JPanel buttonPanel = new JPanel();
            buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
            buttonPanel.add(submitButton);
            buttonPanel.add(cancelButton);

            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent arg0) {
                    a.dispose();
                }
            });

            submitButton.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent arg0) {
                    a.dispose();
                    final JDialog a = new JDialog();
                    a.setSize(new Dimension(500, 450));
                    a.setModal(true);
                    a.setTitle("Statistics");
                    a.setLocationRelativeTo(null);

                    if (grn.getTimeSeries().isEmpty()) {
                        JOptionPane.showMessageDialog(new Frame(), "Please run the simulation first.",
                                "Warning!", JOptionPane.INFORMATION_MESSAGE);
                    } else {
                        JPanel infoPanel = new JPanel();
                        infoPanel.setLayout(new BorderLayout());

                        //output 
                        String[] focusGenes = focusGenesArea.getText().split(";");
                        ;
                        String content = "";

                        //discrete the final state
                        int dimension = grn.getNodes().size();

                        //get gene index
                        int[] focus_index = new int[focusGenes.length];
                        for (int j = 0; j < focusGenes.length; j++)
                            for (int i = 0; i < dimension; i++)
                                if (grn.getNode(i).getLabel().equals(focusGenes[j]))
                                    focus_index[j] = i;

                        JScrollPane jsp = new JScrollPane();
                        //calculate steady states      
                        grn.setLand_itsValue((Integer) numTimeSeries_.getModel().getValue());
                        int[] isConverge = new int[grn.getTraj_itsValue()];
                        String out = calculateSteadyStates(focusGenes, focus_index, isConverge);

                        //show the convergence
                        final JDialog ifconvergent = new JDialog();
                        ifconvergent.setSize(new Dimension(500, 450));
                        ifconvergent.setModal(true);
                        ifconvergent.setTitle("Convergence");
                        ifconvergent.setLocationRelativeTo(null);

                        ConvergenceTable tablePanel = new ConvergenceTable(isConverge);
                        JButton continueButton = new JButton("Click to check the attractors.");
                        continueButton.addActionListener(new ActionListener() {
                            public void actionPerformed(final ActionEvent arg0) {
                                ifconvergent.dispose();
                            }
                        });

                        JPanel ifconvergentPanel = new JPanel();
                        ifconvergentPanel.setLayout(new BorderLayout());
                        ifconvergentPanel.add(tablePanel, BorderLayout.NORTH);
                        ifconvergentPanel.add(continueButton, BorderLayout.SOUTH);

                        ifconvergent.add(ifconvergentPanel);
                        ifconvergent.setVisible(true);

                        //show attractors
                        if (out.equals("ok")) {
                            AttractorTable panel = new AttractorTable(grn, focusGenes);
                            jsp.setViewportView(panel);
                        } else if (grn.getSumPara().size() == 0)
                            content += "Cannot find a steady state!";
                        else
                            content += "\nI dont know why!";

                        if (content != "") {
                            JLabel warningLabel = new JLabel();
                            warningLabel.setText(content);
                            jsp.setViewportView(warningLabel);
                        }

                        grn.setSumPara(null);
                        grn.setCounts(null);

                        //jsp.setPreferredSize(new Dimension(280,130));
                        jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
                        jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
                        infoPanel.add(jsp, BorderLayout.CENTER);

                        a.add(infoPanel);
                        a.setVisible(true);
                    } //end of else
                }

            });

            JPanel options3 = new JPanel();
            options3.setLayout(new BorderLayout());
            options3.add(focusGenesArea, BorderLayout.NORTH);
            options3.add(buttonPanel);

            options3.setBorder(new EmptyBorder(5, 0, 5, 0));

            a.add(options3);
            a.setVisible(true);
        }
    });

    runButton_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            //System.out.print("Memory start: "+s_runtime.totalMemory()+"\n"); 
            enterAction();
        }
    });

    cancelButton_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            if (simulation != null)
                simulation.stop();
            System.out.print("Simulation is canceled!\n");
        }
    });

    fixButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            JDialog a = new JDialog();
            a.setTitle("Fixed initial values");
            a.setSize(new Dimension(400, 400));
            a.setLocationRelativeTo(null);

            JPanel speciesPanel = new JPanel();
            String[] columnName = { "Name", "InitialValue" };
            boolean editable = false; //false;
            new SpeciesTable(speciesPanel, columnName, grn, editable);

            /** LAYOUT **/
            JPanel wholePanel = new JPanel();
            wholePanel.setLayout(new BoxLayout(wholePanel, BoxLayout.Y_AXIS));
            wholePanel.add(speciesPanel);

            a.add(wholePanel);
            a.setModal(true);
            a.setVisible(true);
        }
    });

    randomButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            final JDialog a = new JDialog();
            a.setTitle("Set boundaries");
            a.setSize(new Dimension(300, 200));
            a.setModal(true);
            a.setLocationRelativeTo(null);

            JPanel upPanel = new JPanel();
            JLabel upLabel = new JLabel("Input the upper boundary: ");
            final JTextField upValue = new JTextField("3");
            upPanel.setLayout(new BoxLayout(upPanel, BoxLayout.X_AXIS));
            upPanel.add(upLabel);
            upPanel.add(upValue);

            JPanel lowPanel = new JPanel();
            JLabel lowLabel = new JLabel("Input the lower boundary: ");
            final JTextField lowValue = new JTextField("0");
            lowPanel.setLayout(new BoxLayout(lowPanel, BoxLayout.X_AXIS));
            lowPanel.add(lowLabel);
            lowPanel.add(lowValue);

            JPanel buttonPanel = new JPanel();
            JButton submit = new JButton("Submit");
            JButton cancel = new JButton("Cancel");
            buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
            buttonPanel.add(submit);
            buttonPanel.add(cancel);
            buttonPanel.setBorder(new EmptyBorder(5, 5, 5, 5));

            submit.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    if (upValue.getText().equals(""))
                        JOptionPane.showMessageDialog(null, "Please input upper boundary", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    else {
                        try {
                            upbound = Double.parseDouble(upValue.getText());

                            if (lowValue.getText().equals(""))
                                JOptionPane.showMessageDialog(null, "Please input lower boundary", "Error",
                                        JOptionPane.ERROR_MESSAGE);
                            else {
                                try {
                                    lowbound = Double.parseDouble(lowValue.getText());

                                    if (upbound < lowbound)
                                        JOptionPane.showMessageDialog(null,
                                                "Upper boundary should be not less than lower boundary",
                                                "Error", JOptionPane.ERROR_MESSAGE);
                                    else
                                        a.dispose();
                                } catch (Exception er) {
                                    JOptionPane.showMessageDialog(null, "Invalid value", "Error",
                                            JOptionPane.INFORMATION_MESSAGE);
                                    MsgManager.Messages.errorMessage(er, "Error", "");
                                }
                            }
                        } catch (Exception er) {
                            JOptionPane.showMessageDialog(null, "Invalid value", "Error",
                                    JOptionPane.INFORMATION_MESSAGE);
                            MsgManager.Messages.errorMessage(er, "Error", "");
                        }
                    }

                }
            });

            cancel.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    JOptionPane.showMessageDialog(null, "The default values are used!", "",
                            JOptionPane.INFORMATION_MESSAGE);
                    a.dispose();
                }
            });

            JPanel wholePanel = new JPanel();
            wholePanel.setLayout(new BoxLayout(wholePanel, BoxLayout.Y_AXIS));
            wholePanel.add(upPanel);
            wholePanel.add(lowPanel);
            wholePanel.add(buttonPanel);
            wholePanel.setBorder(new EmptyBorder(5, 5, 5, 5));

            a.add(wholePanel);
            a.setVisible(true);

        }
    });
}