Example usage for javax.swing JTextArea getBorder

List of usage examples for javax.swing JTextArea getBorder

Introduction

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

Prototype

public Border getBorder() 

Source Link

Document

Returns the border of this component or null if no border is currently set.

Usage

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

/**
 * Creates a JTextArea for display purposes only.
 * @param cellField FormCellField info//w  w  w  . ja v a 2  s .co m
 * @return the control
 */
public static JScrollPane changeTextAreaForDisplay(final JTextArea ta) {
    Insets insets = ta.getBorder().getBorderInsets(ta);
    ta.setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.bottom));
    ta.setForeground(Color.BLACK);
    ta.setEditable(false);
    ta.setBackground(viewFieldColor.getColor());
    ta.setLineWrap(true);
    ta.setWrapStyleWord(true);

    JScrollPane scrollPane = new JScrollPane(ta);
    insets = scrollPane.getBorder().getBorderInsets(scrollPane);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane
            .setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.bottom));

    return scrollPane;
}