File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Space between Border and  a Component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Space between Border and  a Component" Watch "Space between Border and  a Component" New topic

Space between Border and a Component

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
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.

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
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

Joined: Jul 11, 2001
Posts: 14112
If that fails, use a CompoundBorder, with an EmptyBorder as the inner border.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I agree. Here's the link:
subject: Space between Border and a Component
jQuery in Action, 3rd edition