Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Space between Border and a Component

 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had written a panel which consists of three Buttons and I had set a border for it. When I executed I found there is no space between the Border and the Button Component. What method should I add to have some space between the right and left side of the button and the border.

 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you do this using the components insets. So call something like:

You should do this after setting the border on the component.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If that fails, use a CompoundBorder, with an EmptyBorder as the inner border.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic