• Post Reply Bookmark Topic Watch Topic
  • New Topic

Put padding in textfield  RSS feed

 
SoonAnn Lim
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone help me with this. I want to put more padding effect on JTextField so the input will not so close to the edge of the text field on top and the bottom. Thanks.
 
Angela Lamb
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the setMargin function for this.
JTextField textField = new JTextField("test");
textField.setMargin(new Insets(10, 10, 10, 10));
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!