So I have a JTextArea
which shows the text right from the top left corner. I want some margin on all 4 sides, so there's some space between text and boundary of the area.
I have researched a lot and could not find any solution. How can I do it?
Also, I was thinking maybe put up a label on all 4 sides to create dummy margin. How can I create a JLabel
with certain width and height?
May be I dont understand your question correctly. However you can use setMargin()
// set the margin for all four sides
tt.setMargin( new Insets(10,10,10,10) ); // tt is JTextArea instance
Some Important Links