JTextArea textArea = new JTextArea(); textArea.setMargin(new Insets(5, 10, 5, 10));
JTextArea textArea = new JTextArea(); textArea.setMargin(new Insets(0, 0, 0, 0));In conclusion, javax.swing package library contains JTextArea class which allows you to create multi-line text field. The setMargin() method in JTextArea is used to set margin of the text area. Examples 1 and 2 show how to customize and remove the margin respectively.