Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextArea and padding  RSS feed

 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

In my JTextArea, I would like to add some padding to the inside of the JTextArea so that the text is not so close to the border. I have looked on the internet but I can't seem to find the answer. Could someone point me in the right direction?

Many kind regards,
Rachel
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or perhaps less fragile:

JTextArea ta = new JTextArea(20,30);
ta.setMargin(new Insets(10,10,10,10));
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool, thanks!!

Rachel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!