public void showItem() {

    if (!this.editorPanel.getViewer().isLanguageFunctionAvailable()) {

      return;
    }

    this.highlight =
        this.editorPanel
            .getEditor()
            .addHighlight(this.position, this.position + this.word.length(), null, true);

    final FindSynonymsActionHandler _this = this;

    QTextEditor editor = this.editorPanel.getEditor();

    Rectangle r = null;

    try {

      r = editor.modelToView(this.position);

    } catch (Exception e) {

      // BadLocationException!
      Environment.logError("Location: " + this.position + " is not valid", e);

      UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms.");

      return;
    }

    int y = r.y;

    // Show a panel of all the items.
    final QPopup p = this.popup;

    p.setOpaque(false);

    Synonyms syns = null;

    try {

      syns = this.projectViewer.getSynonymProvider().getSynonyms(this.word);

    } catch (Exception e) {

      UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms.");

      Environment.logError("Unable to lookup synonyms for: " + word, e);

      return;
    }

    if ((syns.words.size() == 0) && (this.word.toLowerCase().endsWith("ed"))) {

      // Trim off the ed and try again.
      try {

        syns = this.projectViewer.getSynonyms(this.word.substring(0, this.word.length() - 2));

      } catch (Exception e) {

        UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms.");

        Environment.logError("Unable to lookup synonyms for: " + word, e);

        return;
      }
    }

    if ((syns.words.size() == 0) && (this.word.toLowerCase().endsWith("s"))) {

      // Trim off the ed and try again.
      try {

        syns = this.projectViewer.getSynonyms(this.word.substring(0, this.word.length() - 1));

      } catch (Exception e) {

        UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms.");

        Environment.logError("Unable to lookup synonyms for: " + word, e);

        return;
      }
    }

    StringBuilder sb = new StringBuilder();

    if (syns.words.size() > 0) {

      sb.append("6px");

      for (int i = 0; i < syns.words.size(); i++) {

        if (sb.length() > 0) {

          sb.append(", ");
        }

        sb.append("p, 3px, [p,90px], 5px");
      }
      /*
                if (syns.words.size () > 0)
                {

                    sb.append (",5px");

                }
      */
    } else {

      sb.append("6px, p, 6px");
    }

    FormLayout summOnly = new FormLayout("3px, fill:380px:grow, 3px", sb.toString());
    PanelBuilder pb = new PanelBuilder(summOnly);

    CellConstraints cc = new CellConstraints();

    int ind = 2;

    Map<String, String> names = new HashMap();
    names.put(Synonyms.ADJECTIVE + "", "Adjectives");
    names.put(Synonyms.NOUN + "", "Nouns");
    names.put(Synonyms.VERB + "", "Verbs");
    names.put(Synonyms.ADVERB + "", "Adverbs");
    names.put(Synonyms.OTHER + "", "Other");

    if (syns.words.size() == 0) {

      JLabel l = new JLabel("No synonyms found.");
      l.setFont(l.getFont().deriveFont(Font.ITALIC));

      pb.add(l, cc.xy(2, 2));
    }

    // Determine what type of word we are looking for.
    for (Synonyms.Part i : syns.words) {

      JLabel l = new JLabel(names.get(i.type + ""));

      l.setFont(l.getFont().deriveFont(Font.ITALIC));
      l.setFont(l.getFont().deriveFont((float) UIUtils.getEditorFontSize(10)));
      l.setBorder(
          new CompoundBorder(
              new MatteBorder(0, 0, 1, 0, Environment.getBorderColor()),
              new EmptyBorder(0, 0, 3, 0)));

      pb.add(l, cc.xy(2, ind));

      ind += 2;

      HTMLEditorKit kit = new HTMLEditorKit();
      HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();

      JTextPane t = new JTextPane(doc);
      t.setEditorKit(kit);
      t.setEditable(false);
      t.setOpaque(false);

      StringBuilder buf =
          new StringBuilder(
              "<style>a { text-decoration: none; } a:hover { text-decoration: underline; }</style><span style='color: #000000; font-size: "
                  + ((int) UIUtils.getEditorFontSize(10) /*t.getFont ().getSize () + 2*/)
                  + "pt; font-family: "
                  + t.getFont().getFontName()
                  + ";'>");

      for (int x = 0; x < i.words.size(); x++) {

        String w = (String) i.words.get(x);

        buf.append("<a class='x' href='http://" + w + "'>" + w + "</a>");

        if (x < (i.words.size() - 1)) {

          buf.append(", ");
        }
      }

      buf.append("</span>");

      t.setText(buf.toString());

      t.addHyperlinkListener(
          new HyperlinkAdapter() {

            public void hyperlinkUpdate(HyperlinkEvent ev) {

              if (ev.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {

                QTextEditor ed = _this.editorPanel.getEditor();

                ed.replaceText(
                    _this.position, _this.position + _this.word.length(), ev.getURL().getHost());

                ed.removeHighlight(_this.highlight);

                _this.popup.setVisible(false);

                _this.projectViewer.fireProjectEvent(
                    ProjectEvent.SYNONYM, ProjectEvent.REPLACE, ev.getURL().getHost());
              }
            }
          });

      // Annoying that we have to do this but it prevents the text from being too small.

      t.setSize(new Dimension(380, Short.MAX_VALUE));

      JScrollPane sp = new JScrollPane(t);

      t.setCaretPosition(0);

      sp.setOpaque(false);
      sp.getVerticalScrollBar().setValue(0);
      /*
                  sp.setPreferredSize (t.getPreferredSize ());
                  sp.setMaximumSize (new Dimension (380,
                                                    75));
      */
      sp.getViewport().setOpaque(false);
      sp.setOpaque(false);
      sp.setBorder(null);
      sp.getViewport().setBackground(Color.WHITE);
      sp.setAlignmentX(Component.LEFT_ALIGNMENT);

      pb.add(sp, cc.xy(2, ind));

      ind += 2;
    }

    JPanel pan = pb.getPanel();
    pan.setOpaque(true);
    pan.setBackground(Color.WHITE);

    this.popup.setContent(pan);

    // r.y -= this.editorPanel.getScrollPane ().getVerticalScrollBar ().getValue ();

    Point po = SwingUtilities.convertPoint(editor, r.x, r.y, this.editorPanel);

    r.x = po.x;
    r.y = po.y;

    // Subtract the insets of the editorPanel.
    Insets ins = this.editorPanel.getInsets();

    r.x -= ins.left;
    r.y -= ins.top;

    this.editorPanel.showPopupAt(this.popup, r, "above", true);
  }
  private void updateEditorView() {
    editorPane.setText("");
    numParameters = 0;
    try {
      java.util.List elements = editableTemplate.getPrintfElements();
      for (Iterator it = elements.iterator(); it.hasNext(); ) {
        PrintfUtil.PrintfElement el = (PrintfUtil.PrintfElement) it.next();
        if (el.getFormat().equals(PrintfUtil.PrintfElement.FORMAT_NONE)) {
          appendText(el.getElement(), PLAIN_ATTR);
        } else {
          insertParameter(
              (ConfigParamDescr) paramKeys.get(el.getElement()),
              el.getFormat(),
              editorPane.getDocument().getLength());
        }
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(
          this,
          "Invalid Format: " + ex.getMessage(),
          "Invalid Printf Format",
          JOptionPane.ERROR_MESSAGE);

      selectedPane = 1;
      printfTabPane.setSelectedIndex(selectedPane);
      updatePane(selectedPane);
    }
  }
 public void newFile() {
   if (!dirty || checkForSave()) {
     textView.setText("");
     consoleView.setText("");
     problemsView.setText("");
     statusView.setText(" Created new file.");
     file = null;
     // reset dirty bit
     dirty = false;
   }
 }
 public void prettyPrint() {
   try {
     // clear old problem messages
     problemsView.setText("");
     // update status view
     statusView.setText(" Parsing ...");
     LispExpr root = Parser.parse(textView.getText());
     statusView.setText(" Pretty Printing ...");
     String newText = PrettyPrinter.prettyPrint(root);
     textView.setText(newText);
     statusView.setText(" Done.");
   } catch (Error e) {
     System.err.println(e.getMessage());
     statusView.setText(" Errors.");
   }
 }
 public void openFile() {
   if (!dirty || checkForSave()) {
     if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
       file = fileChooser.getSelectedFile();
     } else {
       // user cancelled open after all
       return;
     }
     // load file into text view
     textView.setText(physReadTextFile(file));
     // update status
     statusView.setText(" Loaded file \"" + file.getName() + "\".");
     // reset dirty bit
     dirty = false;
   }
 }
  protected void buildErrorPanel() {
    errorPanel = new JPanel();
    GroupLayout layout = new GroupLayout(errorPanel);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    errorPanel.setLayout(layout);
    //    errorPanel.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK));
    errorMessage = new JTextPane();
    errorMessage.setEditable(false);
    errorMessage.setContentType("text/html");
    errorMessage.setText(
        "<html><body>Could not connect to the Processing server.<br>"
            + "Contributions cannot be installed or updated without an Internet connection.<br>"
            + "Please verify your network connection again, then try connecting again.</body></html>");
    errorMessage.setFont(Toolkit.getSansFont(14, Font.PLAIN));
    errorMessage.setMaximumSize(new Dimension(550, 50));
    errorMessage.setOpaque(false);

    StyledDocument doc = errorMessage.getStyledDocument();
    SimpleAttributeSet center = new SimpleAttributeSet();
    StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
    doc.setParagraphAttributes(0, doc.getLength(), center, false);

    closeButton = new JButton("X");
    closeButton.setContentAreaFilled(false);
    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            contribDialog.makeAndShowTab(false, false);
          }
        });
    tryAgainButton = new JButton("Try Again");
    tryAgainButton.setFont(Toolkit.getSansFont(14, Font.PLAIN));
    tryAgainButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            contribDialog.makeAndShowTab(false, true);
            contribDialog.downloadAndUpdateContributionListing(editor.getBase());
          }
        });
    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(errorMessage)
                    .addComponent(
                        tryAgainButton,
                        StatusPanel.BUTTON_WIDTH,
                        StatusPanel.BUTTON_WIDTH,
                        StatusPanel.BUTTON_WIDTH))
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addComponent(closeButton));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout.createParallelGroup().addComponent(errorMessage).addComponent(closeButton))
            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
            .addComponent(tryAgainButton));
    errorPanel.setBackground(Color.PINK);
    errorPanel.validate();
  }
  private void jbInit() throws Exception {

    saveButton.setText("Save");
    saveButton.addActionListener(new PrintfTemplateEditor_saveButton_actionAdapter(this));
    cancelButton.setText("Cancel");
    cancelButton.addActionListener(new PrintfTemplateEditor_cancelButton_actionAdapter(this));
    this.setTitle(this.getTitle() + " Template Editor");
    printfPanel.setLayout(gridBagLayout1);
    formatLabel.setFont(new java.awt.Font("DialogInput", 0, 12));
    formatLabel.setText("Format String:");
    buttonPanel.setLayout(flowLayout1);
    printfPanel.setBorder(BorderFactory.createEtchedBorder());
    printfPanel.setMinimumSize(new Dimension(100, 160));
    printfPanel.setPreferredSize(new Dimension(380, 160));
    parameterPanel.setLayout(gridBagLayout2);
    parameterLabel.setText("Parameters:");
    parameterLabel.setFont(new java.awt.Font("DialogInput", 0, 12));
    parameterTextArea.setMinimumSize(new Dimension(100, 25));
    parameterTextArea.setPreferredSize(new Dimension(200, 25));
    parameterTextArea.setEditable(true);
    parameterTextArea.setText("");
    insertButton.setMaximumSize(new Dimension(136, 20));
    insertButton.setMinimumSize(new Dimension(136, 20));
    insertButton.setPreferredSize(new Dimension(136, 20));
    insertButton.setToolTipText(
        "insert the format in the format string and add parameter to list.");
    insertButton.setText("Insert Parameter");
    insertButton.addActionListener(new PrintfTemplateEditor_insertButton_actionAdapter(this));
    formatTextArea.setMinimumSize(new Dimension(100, 25));
    formatTextArea.setPreferredSize(new Dimension(200, 15));
    formatTextArea.setText("");
    parameterPanel.setBorder(null);
    parameterPanel.setMinimumSize(new Dimension(60, 40));
    parameterPanel.setPreferredSize(new Dimension(300, 40));
    insertMatchButton.addActionListener(
        new PrintfTemplateEditor_insertMatchButton_actionAdapter(this));
    insertMatchButton.setText("Insert Match");
    insertMatchButton.setToolTipText(
        "insert the match in the format string and add parameter to list.");
    insertMatchButton.setPreferredSize(new Dimension(136, 20));
    insertMatchButton.setMinimumSize(new Dimension(136, 20));
    insertMatchButton.setMaximumSize(new Dimension(136, 20));
    matchPanel.setPreferredSize(new Dimension(300, 40));
    matchPanel.setBorder(null);
    matchPanel.setMinimumSize(new Dimension(60, 60));
    matchPanel.setLayout(gridBagLayout3);
    InsertPanel.setLayout(gridLayout1);
    gridLayout1.setColumns(1);
    gridLayout1.setRows(2);
    gridLayout1.setVgap(0);
    InsertPanel.setBorder(BorderFactory.createEtchedBorder());
    InsertPanel.setMinimumSize(new Dimension(100, 100));
    InsertPanel.setPreferredSize(new Dimension(380, 120));
    editorPane.setText("");
    editorPane.addKeyListener(new PrintfEditor_editorPane_keyAdapter(this));
    printfTabPane.addChangeListener(new PrintfEditor_printfTabPane_changeAdapter(this));
    parameterPanel.add(
        insertButton,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(8, 6, 13, 8),
            0,
            10));
    parameterPanel.add(
        paramComboBox,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(8, 8, 13, 0),
            258,
            11));
    paramComboBox.setRenderer(new MyCellRenderer());
    InsertPanel.add(matchPanel, null);
    InsertPanel.add(parameterPanel, null);
    buttonPanel.add(cancelButton, null);
    buttonPanel.add(saveButton, null);
    this.getContentPane().add(printfTabPane, BorderLayout.NORTH);
    this.getContentPane().add(InsertPanel, BorderLayout.CENTER);
    matchPanel.add(
        insertMatchButton,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(8, 6, 13, 8),
            0,
            10));
    matchPanel.add(
        matchComboBox,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(8, 8, 13, 0),
            258,
            11));
    printfPanel.add(
        parameterLabel,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(7, 5, 0, 5),
            309,
            0));
    printfPanel.add(
        formatLabel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(4, 5, 0, 5),
            288,
            0));
    printfPanel.add(
        formatTextArea,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(6, 5, 0, 5),
            300,
            34));
    printfPanel.add(
        parameterTextArea,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(6, 5, 6, 5),
            300,
            34));
    printfTabPane.addTab("Editor View", null, editorPanel, "View in Editor");
    printfTabPane.addTab("Printf View", null, printfPanel, "Vies as Printf");
    editorPane.setCharacterAttributes(PLAIN_ATTR, true);
    editorPane.addStyle("PLAIN", editorPane.getLogicalStyle());
    editorPanel.getViewport().add(editorPane, null);
    this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    buttonGroup.add(cancelButton);
  }
  /** Initialize the user interface components. */
  protected void initUI() throws Exception {

    // Setup the JInternalFrame
    setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
    addInternalFrameListener(new DialogListener());

    // grab Frog object
    Frog frame = debugManager.getFrog();

    // grab location and position window
    Dimension popupSize = getSize();
    Dimension frameSize = frame.getSize();
    setLocation((frameSize.width - popupSize.width) / 4, (frameSize.height - popupSize.height) / 4);

    // Grab TimeSeriesComp object
    GramComp popupComp = gramManager.getGram(popupFrame);
    Gram popupGram = popupComp.getGram();

    // create the main panel
    // ---------------------

    // setup the scroll pane
    JScrollPane scrollPane =
        new JScrollPane(
            textPane,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setPreferredSize(new Dimension(500, 450));
    scrollPane.setMinimumSize(new Dimension(500, 300));
    textPane.setEditable(false);
    textPane.setContentType("text/html");

    // Stuff them into the main panel
    // ------------------------------

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;

    JPanel mainPanel = new JPanel();

    // create the main panel
    mainPanel.setLayout(new GridBagLayout());

    constraints.gridx = 0;
    constraints.gridy = 0;
    mainPanel.add(scrollPane, constraints);
    // create the button panels
    JPanel buttonPanel = new JPanel(new BorderLayout());
    JPanel buttons = new JPanel(new BorderLayout());

    // create the button panel
    // -----------------------
    JLabel buttonLabel = new JLabel("          ");

    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });

    buttons.add(cancelButton, BorderLayout.EAST);

    buttonPanel.add(buttonLabel, BorderLayout.CENTER);
    buttonPanel.add(buttons, BorderLayout.EAST);

    // display everything
    JPanel contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(new BorderLayout());

    contentPane.add(mainPanel, BorderLayout.NORTH);
    contentPane.add(buttonPanel, BorderLayout.SOUTH);

    // Add information to textArea
    // ---------------------------
    String doc = "<html><body>";

    doc = doc + "<h2><u>Periodogram</u></h2>\n";

    doc = doc + "<ul>\n";

    TimeSeriesComp popupTimeComp = popupGram.getTimeSeriesComp();
    TimeSeries popupSeries = popupTimeComp.getSeries();
    String key = seriesManager.getKey(popupTimeComp);

    doc = doc + "<li>The periodogram is associated with <strong>" + key + "</strong>\n";

    if (popupGram.getType() == Gram.UNCLASSIFIED) {
      doc =
          doc
              + "<li>The periodogram is of unknown type\n"
              + "<li><font color=red>Warning: Possible programming error?</font>\n"
              + "</ul>\n";

    } else if (popupGram.getType() == Gram.FOURIER) {
      doc = doc + "<li>The periodogram is a Fourier Transform</ul>\n";

    } else if (popupGram.getType() == Gram.CHISQ) {
      doc = doc + "<li>The periodogram is a Chi-Squared Periodogram</ul>\n";
    }

    // best fit period?
    String periodDoc = "";
    if (popupGram.haveBestPeriod()) {

      double range[] = popupGram.getRange();

      periodDoc = "<h2><u>Best Period</u></h2>\n";
      periodDoc =
          periodDoc
              + "<ul>\n"
              + " <li> Minimum Frequency is "
              + range[0]
              + "\n"
              + " <li> Maximum Frequency is "
              + range[1]
              + "\n"
              + " <li> Maximum power at frequency of "
              + 1.0 / popupGram.getBestPeriod()
              + "\n"
              + " <li> This corresponds to a period of "
              + popupGram.getBestPeriod()
              + "\n</ul>\n";
    }

    // drop document into textArea
    doc = doc + periodDoc + "</body></html>";
    debugManager.print("             Passing HTML Document to textPane...");
    debugManager.print("\n" + doc + "\n");
    textPane.setText(doc);

    // Pack now avoiding problems with the scrollbar?
    pack();
  }
Exemple #9
0
  // Create the display inside the "Capture" tab.
  private JPanel createCapturePanel() {

    // Create the overall panel with a space between each component.
    JPanel panel = new JPanel(new BorderLayout(20, 20));

    // Create container for the bottom buttons.
    JPanel bottomButtons = new JPanel();
    bottomButtons.setLayout(new BoxLayout(bottomButtons, BoxLayout.X_AXIS));

    // Create the bottom buttons and top label.
    recordButton = new JButton("Record");
    recordButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            record();
          }
        });
    stopButton = new JButton("Stop");
    stopButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stopRecord();
          }
        });
    JButton save = new JButton("Save Test");
    save.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            saveTest();
          }
        });
    JButton close = new JButton("Close");
    close.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            closeProgram();
          }
        });
    JLabel updateLabel = new JLabel("Recent Actions:");

    // Create the update box and make it scrollable.
    updateBox = new JTextPane();
    updateBox.setText("Welcome to the JFC Capture/Replay Tool!");
    JScrollPane scroll = new JScrollPane(updateBox);
    updateBox.setEditable(false);

    // Add the update label and box.
    panel.add(updateLabel, BorderLayout.PAGE_START);
    panel.add(scroll, BorderLayout.CENTER);

    // Add the buttons to bottom container and add that to overall.
    bottomButtons.add(recordButton);
    bottomButtons.add(Box.createRigidArea(new Dimension(10, 0)));
    bottomButtons.add(stopButton);
    bottomButtons.add(Box.createRigidArea(new Dimension(10, 0)));
    bottomButtons.add(save);
    bottomButtons.add(Box.createRigidArea(new Dimension(10, 0)));
    bottomButtons.add(close);
    panel.add(bottomButtons, BorderLayout.PAGE_END);
    stopButton.setEnabled(false);

    // Add space in between edge of tab page.
    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    return panel;
  }