Example usage for javax.swing JComponent setBackground

List of usage examples for javax.swing JComponent setBackground

Introduction

In this page you can find the example usage for javax.swing JComponent setBackground.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.")
public void setBackground(Color bg) 

Source Link

Document

Sets the background color of this component.

Usage

From source file:greenfoot.gui.export.ExportPublishPane.java

/**
 * Creates the tag display with popular tags and an option to add tags
 *///w ww  .  j av  a2s .  c o  m
private JComponent getTagDisplay() {
    JComponent tagPanel = new JPanel(new MiksGridLayout(3, 1, 8, 8));
    {
        tagPanel.setBackground(background);
        JComponent popPanel = new JPanel(new MiksGridLayout(8, 1, 8, 0));
        popPanel.setBackground(background);
        JLabel popLabel = new JLabel(Config.getString("export.publish.tags.popular"), SwingConstants.LEADING);
        popLabel.setFont(font);
        popPanel.add(popLabel);
        for (int i = 0; i < popTags.length; i++) {
            JCheckBox popTag = new JCheckBox(Config.getString("export.publish.tags.loading"));
            popTag.setBackground(background);
            popTag.setFont(font);
            popTag.setEnabled(false);
            popTags[i] = popTag;
            popPanel.add(popTag);
        }

        tagPanel.add(popPanel);

        Box textPanel = new Box(BoxLayout.Y_AXIS);
        {
            JLabel additionalLabel = new JLabel(Config.getString("export.publish.tags.additional1"),
                    SwingConstants.LEADING);
            additionalLabel.setFont(font);
            textPanel.add(additionalLabel);

            JLabel additionalLabel2 = new JLabel(Config.getString("export.publish.tags.additional2"),
                    SwingConstants.CENTER);
            additionalLabel2.setFont(font);
            textPanel.add(additionalLabel2);
        }
        tagPanel.add(textPanel);

        tagArea = new JTextArea();
        tagArea.setRows(3);
        JScrollPane tagScroller = new JScrollPane(tagArea);
        tagPanel.add(tagScroller);
    }
    return tagPanel;
}

From source file:greenfoot.gui.export.ExportPublishPane.java

/**
 * Creates a login panel with a username and password and a create account option
 * @return Login panel Component//from   w  w  w.  j av  a  2 s .co m
 */
private JComponent getLoginPanel() {
    JComponent loginPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 4));

    loginPanel.setBackground(background);
    loginPanel.setAlignmentX(LEFT_ALIGNMENT);
    Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(),
            BorderFactory.createEmptyBorder(12, 12, 12, 12));
    loginPanel.setBorder(border);

    JLabel text = new JLabel(Config.getString("export.publish.login"));
    text.setForeground(headingColor);
    text.setVerticalAlignment(SwingConstants.TOP);
    loginPanel.add(text);

    text = new JLabel(Config.getString("export.publish.username"), SwingConstants.TRAILING);
    text.setFont(font);
    loginPanel.add(text);
    userNameField = new JTextField(10);
    userNameField.setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            String text = userNameField.getText();
            return text.length() > 0;
        }
    });
    userNameField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            checkForExistingScenario();
        }
    });
    loginPanel.add(userNameField);
    text = new JLabel(Config.getString("export.publish.password"), SwingConstants.TRAILING);
    text.setFont(font);
    loginPanel.add(text);
    passwordField = new JPasswordField(10);
    loginPanel.add(passwordField);

    JLabel createAccountLabel = new JLabel(Config.getString("export.publish.createAccount"));
    {
        createAccountLabel.setBackground(background);

        createAccountLabel.setHorizontalAlignment(SwingConstants.RIGHT);
        GreenfootUtil.makeLink(createAccountLabel, createAccountUrl);
    }
    loginPanel.add(createAccountLabel);
    return loginPanel;
}

From source file:greenfoot.gui.export.ExportPublishPane.java

/**
 * Creates the scenario information display including information such as title, description, url.
 * For an update (isUpdate = true), the displayed options are slightly different.
 *//*from www  .jav a 2 s. c o m*/
private void createScenarioDisplay() {
    leftPanel = new Box(BoxLayout.Y_AXIS);
    JLabel text;
    MiksGridLayout titleAndDescLayout = new MiksGridLayout(6, 2, 8, 8);
    titleAndDescLayout.setVerticallyExpandingRow(3);

    titleAndDescPanel = new JPanel(titleAndDescLayout);
    titleAndDescPanel.setBackground(background);

    if (imagePanel == null) {
        imagePanel = new ImageEditPanel(IMAGE_WIDTH, IMAGE_HEIGHT);
        imagePanel.setBackground(background);
    }

    Box textPanel = new Box(BoxLayout.Y_AXIS);
    {
        text = new JLabel(Config.getString("export.publish.image1"));
        text.setAlignmentX(Component.RIGHT_ALIGNMENT);
        text.setFont(font);
        textPanel.add(text);
        text = new JLabel(Config.getString("export.publish.image2"));
        text.setAlignmentX(Component.RIGHT_ALIGNMENT);
        text.setFont(font);
        textPanel.add(text);
    }
    titleAndDescPanel.add(textPanel);
    titleAndDescPanel.add(imagePanel);

    if (isUpdate) {
        text = new JLabel(Config.getString("export.snapshot.label"), SwingConstants.TRAILING);
        text.setFont(font);
        titleAndDescPanel.add(text);

        keepScenarioScreenshot = new JCheckBox();
        keepScenarioScreenshot.setSelected(true);
        // "keep screenshot" defaults to true, therefore the image panel should be disabled
        imagePanel.enableImageEditPanel(false);
        keepScenarioScreenshot.setName(Config.getString("export.publish.keepScenario"));
        keepScenarioScreenshot.setOpaque(false);
        keepScenarioScreenshot.addChangeListener(this);
        titleAndDescPanel.add(keepScenarioScreenshot);
    }

    text = new JLabel(Config.getString("export.publish.title"), SwingConstants.TRAILING);
    text.setFont(font);
    titleAndDescPanel.add(text);

    String title = project.getName();
    if (getTitle() != null) {
        title = getTitle();
    }
    titleField = new JTextField(title);
    titleField.setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            String text = titleField.getText();
            return text.length() > 0;
        }
    });
    titleField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            checkForExistingScenario();
        }
    });
    titleAndDescPanel.add(titleField);

    // If there is an update a "changes" description area is shown.
    // If not there a short description and long description area are shown.
    if (isUpdate) {
        JLabel updateLabel = new JLabel(Config.getString("export.publish.update"), SwingConstants.TRAILING);
        updateLabel.setVerticalAlignment(SwingConstants.TOP);
        updateLabel.setFont(font);

        updateArea = new JTextArea();
        updateArea.setRows(6);
        updateArea.setLineWrap(true);
        updateArea.setWrapStyleWord(true);
        JScrollPane updatePane = new JScrollPane(updateArea);

        titleAndDescPanel.add(updateLabel);
        titleAndDescPanel.add(updatePane);
        titleAndDescLayout.setVerticallyExpandingRow(4);
    } else {
        text = new JLabel(Config.getString("export.publish.shortDescription"), SwingConstants.TRAILING);
        text.setFont(font);
        shortDescriptionField = new JTextField();
        titleAndDescPanel.add(text);
        titleAndDescPanel.add(shortDescriptionField);
        text = new JLabel(Config.getString("export.publish.longDescription"), SwingConstants.TRAILING);
        text.setVerticalAlignment(SwingConstants.TOP);
        text.setFont(font);

        descriptionArea = new JTextArea();
        descriptionArea.setRows(6);
        descriptionArea.setLineWrap(true);
        descriptionArea.setWrapStyleWord(true);
        JScrollPane description = new JScrollPane(descriptionArea);
        titleAndDescPanel.add(text);
        titleAndDescPanel.add(description);
    }

    text = new JLabel(Config.getString("export.publish.url"), SwingConstants.TRAILING);
    text.setFont(font);
    titleAndDescPanel.add(text);

    urlField = new JTextField();
    titleAndDescPanel.add(urlField);

    leftPanel.add(titleAndDescPanel, BorderLayout.SOUTH);

    JComponent sourceAndLockPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 0));
    {
        sourceAndLockPanel.setBackground(background);
        includeSource = new JCheckBox(Config.getString("export.publish.includeSource"));
        includeSource.setOpaque(false);
        includeSource.setSelected(false);
        includeSource.setFont(font);
        sourceAndLockPanel.add(includeSource);
        lockScenario.setFont(font);
        sourceAndLockPanel.add(lockScenario);
        sourceAndLockPanel.setMaximumSize(sourceAndLockPanel.getPreferredSize());
    }

    leftPanel.add(sourceAndLockPanel, BorderLayout.SOUTH);
}

From source file:lcmc.gui.resources.EditableInfo.java

/**
 * Adds field with left and right component to the panel. Use panel
 * with spring layout for this./*w  ww  . j a  v  a 2 s.c o  m*/
 */
public final void addField(final JPanel panel, final JComponent left, final JComponent right,
        final int leftWidth, final int rightWidth, int height) {
    /* right component with fixed width. */
    if (height == 0) {
        height = Tools.getDefaultSize("Browser.FieldHeight");
    }
    Tools.setSize(left, leftWidth, height);
    panel.add(left);
    Tools.setSize(right, rightWidth, height);
    panel.add(right);
    right.setBackground(panel.getBackground());
}

From source file:edu.ku.brc.af.ui.forms.validation.ValFormattedTextField.java

/**
 * Creates the various UI Components for the formatter.
 *//*w  w w .j  a v a  2s.  c  o m*/
protected void createUI() {
    CellConstraints cc = new CellConstraints();

    if (isViewOnly
            || (formatter != null && !formatter.isUserInputNeeded() && fields != null && fields.size() == 1)) {
        viewtextField = new JTextField();
        setControlSize(viewtextField);

        // Remove by rods 12/5/08 this messes thihngs up
        // values don't get inserted correctly, shouldn't be needed anyway

        //JFormattedDoc document = new JFormattedDoc(viewtextField, formatter, formatter.getFields().get(0));
        //viewtextField.setDocument(document);
        //document.addDocumentListener(this);
        //documents.add(document);

        ViewFactory.changeTextFieldUIForDisplay(viewtextField, false);
        PanelBuilder builder = new PanelBuilder(new FormLayout("1px,f:p:g,1px", "1px,f:p:g,1px"), this);
        builder.add(viewtextField, cc.xy(2, 2));
        bgColor = viewtextField.getBackground();

    } else {
        JTextField txt = new JTextField();

        Font txtFont = txt.getFont();

        Font font = new Font("Courier", Font.PLAIN, txtFont.getSize());

        BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
        Graphics2D g = bi.createGraphics();
        g.setFont(font);
        FontMetrics fm = g.getFontMetrics(font);
        g.dispose();

        Insets ins = txt.getBorder().getBorderInsets(txt);
        int baseWidth = ins.left + ins.right;

        bgColor = txt.getBackground();

        StringBuilder sb = new StringBuilder("1px");
        for (UIFieldFormatterField f : fields) {
            sb.append(",");
            if (f.getType() == FieldType.separator || f.getType() == FieldType.constant) {
                sb.append('p');
            } else {
                sb.append(((fm.getMaxAdvance() * f.getSize()) + baseWidth) + "px");
            }
        }
        sb.append(",1px");
        PanelBuilder builder = new PanelBuilder(new FormLayout(sb.toString(), "1px,P:G,1px"), this);

        comps = new JComponent[fields.size()];
        int inx = 0;
        for (UIFieldFormatterField f : fields) {
            JComponent comp = null;
            JComponent tfToAdd = null;

            if (f.getType() == FieldType.separator || f.getType() == FieldType.constant) {
                comp = createLabel(f.getValue());
                if (f.getType() == FieldType.constant) {
                    comp.setBackground(Color.WHITE);
                    comp.setOpaque(true);
                }
                tfToAdd = comp;

            } else {
                JTextField tf = new BGTextField(f.getSize(), isViewOnly ? "" : f.getValue());
                tfToAdd = tf;

                if (inx == 0) {
                    tf.addKeyListener(new KeyAdapter() {
                        @Override
                        public void keyPressed(KeyEvent e) {
                            checkForPaste(e);
                        }
                    });
                }

                JFormattedDoc document = new JFormattedDoc(tf, formatter, f);
                tf.setDocument(document);
                document.addDocumentListener(new DocumentAdaptor() {
                    @Override
                    protected void changed(DocumentEvent e) {
                        isChanged = true;
                        if (!shouldIgnoreNotifyDoc) {
                            String fldStr = getText();
                            int len = StringUtils.isNotEmpty(fldStr) ? fldStr.length() : 0;
                            if (formatter != null && len > 0 && formatter.isLengthOK(len)) {
                                setState(formatter.isValid(fldStr) ? UIValidatable.ErrorType.Valid
                                        : UIValidatable.ErrorType.Error);
                                repaint();
                            }

                            //validateState();
                            if (changeListener != null) {
                                changeListener.stateChanged(new ChangeEvent(this));
                            }

                            if (documentListeners != null) {
                                for (DocumentListener dl : documentListeners) {
                                    dl.changedUpdate(null);
                                }
                            }
                        }
                        currCachedValue = null;
                    }
                });
                documents.add(document);

                addFocusAdapter(tf);

                comp = tf;
                comp.setFont(font);

                if (f.isIncrementer()) {
                    editTF = tf;
                    cardLayout = new CardLayout();
                    cardPanel = new JPanel(cardLayout);
                    cardPanel.add("edit", tf);

                    viewTF = new BGTextField(f.getSize(), isViewOnly ? "" : f.getValue());
                    viewTF.setDocument(document);
                    cardPanel.add("view", viewTF);

                    cardLayout.show(cardPanel, "view");
                    comp = cardPanel;
                    tfToAdd = cardPanel;
                }
            }

            setControlSize(tfToAdd);
            builder.add(comp, cc.xy(inx + 2, 2));
            comps[inx] = tfToAdd;
            inx++;
        }
    }
}

From source file:SortableTable.java

/**
 * Returns the renderer component.//www .ja v a 2  s . co  m
 *
 * @param table      the table.
 * @param value      the value.
 * @param isSelected selected?
 * @param hasFocus   focussed?
 * @param row        the row.
 * @param column     the column.
 * @return the renderer.
 */
public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected,
        final boolean hasFocus, final int row, final int column) {

    if (table == null) {
        throw new NullPointerException("Table must not be null.");
    }

    final JComponent component;
    final SortableTableModel model = (SortableTableModel) table.getModel();
    final int cc = table.convertColumnIndexToModel(column);
    final boolean isSorting = (model.getSortingColumn() == cc);
    final boolean isAscending = model.isAscending();

    final JTableHeader header = table.getTableHeader();
    final boolean isPressed = (cc == this.pressedColumn);

    if (this.useLabels) {
        final JLabel label = getRendererLabel(isSorting, isAscending);
        label.setText((value == null) ? "" : value.toString());
        component = label;
    } else {
        final JButton button = getRendererButton(isSorting, isAscending);
        button.setText((value == null) ? "" : value.toString());
        button.getModel().setPressed(isPressed);
        button.getModel().setArmed(isPressed);
        component = button;
    }

    if (header != null) {
        component.setForeground(header.getForeground());
        component.setBackground(header.getBackground());
        component.setFont(header.getFont());
    }
    return component;
}

From source file:com.isencia.passerelle.hmi.generic.GenericHMI.java

private JPanel createCompositePanel(final JPanel b, final JComponent c, final String name) {
    final JPanel compositeBox = new JPanel(new VerticalLayout(5));
    int r = b.getBackground().getRed() - 20;
    if (r < 1) {
        r = 0;//ww  w  .  j a  v a2  s .co  m
    }
    if (r > 254) {
        r = 255;
    }
    int g = b.getBackground().getGreen() - 20;
    if (g < 1) {
        g = 0;
    }
    if (g > 254) {
        g = 255;
    }
    int bl = b.getBackground().getBlue() - 20;
    if (bl < 1) {
        bl = 0;
    }
    if (bl > 254) {
        bl = 255;
    }

    compositeBox.setBackground(new Color(r, g, bl));
    final JPanel title = new JPanel(new BorderLayout());
    title.setBackground(new Color(r, g, bl));
    /*
     * ImageIcon icon = new ImageIcon( Toolkit .getDefaultToolkit()
     * .getImage( (getClass()
     * .getResource("/com/isencia/passerelle/hmi/resources/composite.gif"
     * )))); JLabel lab = new JLabel(icon);
     * 
     * title.add(lab, BorderLayout.LINE_START);
     */
    final JLabel lab2 = new JLabel(name);
    final Font f = lab2.getFont();
    lab2.setFont(new Font(f.getName(), f.getStyle(), f.getSize() + 6));
    lab2.setForeground(new Color(49, 106, 196));
    title.add(lab2);
    compositeBox.add(title);
    final Border loweredbevel = BorderFactory.createLoweredBevelBorder();
    final TitledBorder border = BorderFactory.createTitledBorder(loweredbevel);

    compositeBox.setBorder(border);
    compositeBox.setName(name);
    c.setBackground(new Color(r, g, bl));
    compositeBox.add(c);
    return compositeBox;
}

From source file:com.projity.pm.graphic.frames.GraphicManager.java

public void setRibbon(JRibbonFrame frame, MenuManager menuManger) {

    final JPanel filtersPanel = new JPanel(new GridLayout(3, 1));
    filterToolBarManager = FilterToolBarManager.create(getMenuManager());
    filterToolBarManager.addButtonsInRibbonBand(filtersPanel);

    CustomRibbonBandGenerator customBandsGenerator = new CustomRibbonBandGenerator() {

        @Override/*w  w w  .  j a  va 2 s .c o m*/
        public JComponent createRibbonComponent(String ribbonBandName) {
            if ("FiltersRibbonBand".equals(ribbonBandName)) {
                return filtersPanel;
            } else
                return null;
        }
    };

    Collection<RibbonTask> ribbonTasks = menuManger.getRibbon(MenuManager.STANDARD_RIBBON,
            customBandsGenerator);
    JRibbon ribbon = frame.getRibbon();

    for (RibbonTask ribbonTask : ribbonTasks) {
        ribbon.addTask(ribbonTask);
    }

    RibbonApplicationMenu applicationMenu = new RibbonApplicationMenu();

    ribbon.setApplicationMenu(applicationMenu);

    Collection<AbstractCommandButton> taskBars = menuManger.getTaskBar(MenuManager.STANDARD_RIBBON);
    for (AbstractCommandButton button : taskBars)
        ribbon.addTaskbarComponent(button);

    ribbon.configureHelp(IconManager.getRibbonIcon("ribbon.help", 26, 26), new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            showHelpDialog();

        }
    });

    JLabel openprojLogo = ribbon.getOpenprojLogo();
    openprojLogo.setIcon(IconManager.getIcon("logo.OpenProj"));
    openprojLogo.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent me) {
            BrowserControl.displayURL("http://www.projity.com/");
        }
    });

    JPanel projectViews = ribbon.getProjectViews();
    projectViews.setBorder(new EmptyBorder(0, 0, 0, 0));
    getMenuManager().initComponent(MenuManager.RIBBON_VIEW_BAR, projectViews);

    JPanel fileSelector = ribbon.getFileSelector();
    fileSelector.setLayout(new BorderLayout());
    fileSelector.setBackground(ProjectLibreRibbonUI.RIBBON_MENU_COLOR);
    JComponent filesComponent = ((DefaultFrameManager) getFrameManager()).getProjectComboPanel();
    filesComponent.setBackground(ProjectLibreRibbonUI.RIBBON_MENU_COLOR);
    fileSelector.add(filesComponent, BorderLayout.EAST);
    projectViews.setBorder(new EmptyBorder(0, 0, 0, 0));

}

From source file:org.drugis.addis.gui.WelcomeDialog.java

private void setBorder(JComponent pane) {
    pane.setPreferredSize(new Dimension(TEXT_WIDTH, COMP_HEIGHT));
    pane.setBorder(ETCHED_BORDER);/*w w w .  j a  va2  s .com*/
    pane.setBackground(Color.white);
}

From source file:org.isatools.isacreator.gui.DataEntryForm.java

/**
 * Adds the fields describing a section to a Container (e.g. JPanel, Box, etc.)
 *
 * @param containerToAddTo @see JPanel, @see Box, @see  Container
 * @param sectionToAddTo   - @see InvestigationFileSection as a reference for where the fields are being added
 * @param fieldValues      - Map of field name to values.
 * @param referenceObject  - A @see DataEntryReferenceObject which gives information about
 *///from  w w  w  .  j av a2  s  .  co  m
public void addFieldsToPanel(Container containerToAddTo, InvestigationFileSection sectionToAddTo,
        OrderedMap<String, String> fieldValues, DataEntryReferenceObject referenceObject) {

    if (fieldDefinitions == null) {
        fieldDefinitions = new ListOrderedMap<String, JComponent>();
    }

    Set<String> ontologyFields = referenceObject.getOntologyTerms(sectionToAddTo);
    Set<String> fieldsToIgnore = referenceObject.getFieldsToIgnore();

    for (String fieldName : fieldValues.keySet()) {

        if (!fieldsToIgnore.contains(fieldName)) {
            FieldObject fieldDescriptor = referenceObject.getFieldDefinition(fieldName);

            if (!fieldDescriptor.isHidden()) {
                String tmpFieldName = fieldName;

                if (realNamesToAliases.containsKey(fieldName)) {
                    tmpFieldName = realNamesToAliases.get(fieldName);
                }

                JPanel fieldPanel = createFieldPanel(1, 2);
                JLabel fieldLabel = createLabel(tmpFieldName);

                JComponent textComponent;

                if (fieldDescriptor.getDatatype() == DataTypes.STRING
                        || fieldDescriptor.getDatatype() == DataTypes.ONTOLOGY_TERM
                        || fieldDescriptor.getDatatype() == DataTypes.DATE) {
                    textComponent = new RoundedJTextField(10);
                } else if (fieldDescriptor.getDatatype() == DataTypes.LONG_STRING) {
                    textComponent = new JTextArea();

                    ((JTextArea) textComponent).setSelectionColor(UIHelper.LIGHT_GREEN_COLOR);
                    ((JTextArea) textComponent).setSelectedTextColor(UIHelper.BG_COLOR);

                    ((JTextArea) textComponent).setWrapStyleWord(true);
                    ((JTextArea) textComponent).setLineWrap(true);
                    textComponent.setBackground(UIHelper.BG_COLOR);
                    textComponent.setBorder(UIHelper.GREEN_ROUNDED_BORDER);
                } else if (fieldDescriptor.getDatatype() == DataTypes.LIST) {
                    textComponent = new JComboBox(fieldDescriptor.getFieldList());
                } else {
                    textComponent = new RoundedJTextField(10);
                }

                if (textComponent instanceof JTextArea || textComponent instanceof JTextComponent) {
                    ((JTextComponent) textComponent)
                            .setText(fieldValues.get(fieldName).equals("") ? fieldDescriptor.getDefaultVal()
                                    : fieldValues.get(fieldName));
                }
                textComponent.setToolTipText(fieldDescriptor.getDescription());

                UIHelper.renderComponent(textComponent, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR,
                        false);

                fieldPanel.add(fieldLabel);

                if (textComponent instanceof JTextArea) {

                    JScrollPane invDescScroll = new JScrollPane(textComponent,
                            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
                    invDescScroll.setPreferredSize(new Dimension(200, 75));

                    invDescScroll.getViewport().setBackground(UIHelper.BG_COLOR);

                    ((JTextArea) textComponent).getDocument().addDocumentListener(new DocumentChangeListener());

                    IAppWidgetFactory.makeIAppScrollPane(invDescScroll);
                    fieldPanel.add(
                            UIHelper.createTextEditEnableJTextArea(invDescScroll, (JTextArea) textComponent));
                } else if (textComponent instanceof JTextComponent) {

                    if (fieldDescriptor.getDatatype() == DataTypes.ONTOLOGY_TERM
                            || ontologyFields.contains(fieldName)) {
                        fieldPanel.add(createOntologyDropDown(fieldName, (JTextComponent) textComponent, true,
                                false, fieldDescriptor.getRecommmendedOntologySource()));
                    } else if (fieldDescriptor.getDatatype() == DataTypes.DATE) {
                        fieldPanel.add(createDateDropDown((JTextComponent) textComponent));
                    } else if (fieldDescriptor.isAcceptsFileLocations()) {
                        fieldPanel.add(createFileField((JTextComponent) textComponent));
                    } else {
                        fieldPanel.add(textComponent);
                    }
                    ((JTextComponent) textComponent).getDocument()
                            .addDocumentListener(new DocumentChangeListener());
                } else {
                    fieldPanel.add(textComponent);
                }

                fieldDefinitions.put(tmpFieldName, textComponent);

                containerToAddTo.add(fieldPanel);
                containerToAddTo.add(Box.createVerticalStrut(5));
            }
        }
    }
}