/**
   * Adds a row with standard color type labels.
   *
   * <p>The labels that will be created are:
   *
   * <pre>
   *    &lt;EMPTY&gt; | Text | Background | (Preview)
   * </pre>
   *
   * @param panel panel in which to add the label row.
   * @param includePreview whether or not to add the <code>preview</code> label.
   */
  protected void addLabelRow(ProportionalGridPanel panel, boolean includePreview) {
    // Skips first column.
    panel.add(new JLabel());

    // Creates the standard labels.
    panel.add(createCaptionLabel("theme_editor.text"));
    panel.add(createCaptionLabel("theme_editor.background"));

    // Adds the preview label if requested.
    if (includePreview) panel.add(createCaptionLabel("preview"));
  }
  /**
   * Adds color buttons to the specified panel.
   *
   * <p>This method will create a row containing the following items:
   *
   * <pre>
   * LABEL | COLOR (foreground) | COLOR (background)
   * </pre>
   *
   * @param gridPanel a 3 columns proportinal grid panel in which to add the buttons.
   * @param fontChooser used to decide which font to use in each color button's preview.
   * @param label label for the row.
   * @param foregroundId identifier of the color to display in the foreground button.
   * @param backgroundId identifier of the color to display in the background button.
   * @param comp component to register as a listener on the color buttons.
   */
  protected PreviewLabel addColorButtons(
      ProportionalGridPanel gridPanel,
      FontChooser fontChooser,
      String label,
      int foregroundId,
      int backgroundId,
      JComponent comp) {
    ColorButton colorButton;
    PreviewLabel previewLabel;

    // Adds the row's caption label.
    gridPanel.add(createCaptionLabel(label));

    // Initialises the color buttons' preview label.
    previewLabel = new PreviewLabel();
    previewLabel.setTextPainted(true);
    addFontChooserListener(fontChooser, previewLabel);

    // Creates the foreground color button.
    gridPanel.add(
        colorButton =
            new ColorButton(
                parent,
                themeData,
                foregroundId,
                PreviewLabel.FOREGROUND_COLOR_PROPERTY_NAME,
                previewLabel));
    if (comp != null) colorButton.addUpdatedPreviewComponent(comp);

    // Creates the background color button.
    gridPanel.add(
        colorButton =
            new ColorButton(
                parent,
                themeData,
                backgroundId,
                PreviewLabel.BACKGROUND_COLOR_PROPERTY_NAME,
                previewLabel));
    if (comp != null) colorButton.addUpdatedPreviewComponent(comp);

    return previewLabel;
  }