JDK-4154670 : JTextArea does not have a border, but JTextField does.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1998-07-06
  • Updated: 1999-11-06
  • Resolved: 1999-11-06
Related Reports
Duplicate :  
Relates :  
Description
The code below needs the setBorder() method invocation on JTextArea.
But JTextFields do ont need it.

	- eduardo

// JTextComponent comes with a border but JTextArea does not.

import com.sun.java.swing.*;
import com.sun.java.swing.border.LineBorder;

public class Test extends JPanel {

    public static JFrame frame;
    public static JTextArea t;

    public static void main(String args[]) {
	frame = new JFrame("Short");

	Box topBox = Box.createVerticalBox();
	
	Box box = Box.createHorizontalBox();
	box.add(new JTextField("one", 10));
	box.add(t = new JTextArea("two", 1, 10));
	t.setBorder(LineBorder.createGrayLineBorder());
	topBox.add(box);
	
	
	frame.getContentPane().add("Center", topBox);
	frame.pack();
	frame.show();
    }
}