Example usage for javax.swing JTextArea setForeground

List of usage examples for javax.swing JTextArea setForeground

Introduction

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

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The foreground color of the component.")
public void setForeground(Color fg) 

Source Link

Document

Sets the foreground color of this component.

Usage

From source file:phenoviewer.ReNameJFrame.java

private void showError(Vector error) {
    // show the error massage
    JTextArea textArea = new JTextArea(10, 40);
    textArea.setEditable(false);//  w w  w.j  a  v  a  2s  .c o m
    String m = "";
    for (int i = 0; i < error.size(); i++) {
        m += error.get(i) + "\n";
    }

    textArea.setText(m);
    textArea.setForeground(Color.RED);
    JScrollPane scrollPane = new JScrollPane(textArea);
    JOptionPane.showMessageDialog(null, scrollPane, "Error Message", JOptionPane.ERROR_MESSAGE);

    return;
}